Commit f9ed06f0 authored by Michael Smith's avatar Michael Smith

Fix a leak in ogginfo.

Workaround for zero-length strings in utf8.c, to avoid crashes.

svn path=/trunk/vorbis-tools/; revision=3510
parent 96747449
......@@ -306,16 +306,14 @@ static void vorbis_process(stream_processor *stream, ogg_page *page )
}
if(!broken) {
/* A hack around brokenness in the utf8 decoder */
if(strlen(sep+1) == 0)
decoded = sep+1;
else if(utf8_decode(sep+1, &decoded) < 0) {
if(utf8_decode(sep+1, &decoded) < 0) {
warn(_("Warning: Failure in utf8 decoder. This "
"should be impossible\n"));
continue;
}
*sep = 0;
info("\t%s=%s\n", inf->vc.user_comments[i], decoded);
free(decoded);
}
}
}
......
......@@ -305,6 +305,12 @@ int utf8_decode(const char *from, char **to)
{
char *charset;
if(*from == 0) {
*to = malloc(1);
**to = 0;
return 1;
}
if (!current_charset)
convert_set_charset(0);
charset = current_charset ? current_charset : "US-ASCII";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment