Fix two memory leaks.

This commit is contained in:
Konrad Borowski 2013-10-19 22:10:26 +02:00
parent 2a6eb83fb4
commit fd25a6425c
2 changed files with 6 additions and 0 deletions

View file

@ -398,6 +398,9 @@ start_conversion:
{ {
debug(0, L"%d %d", in_len, out_len); debug(0, L"%d %d", in_len, out_len);
debug(0, L"Error while converting from to string"); debug(0, L"Error while converting from to string");
/* Terminate the output string. */
free(out);
return 0; return 0;
} }

View file

@ -276,7 +276,10 @@ _xdg_mime_magic_parse_header(FILE *magic_file, XdgMimeMagicMatch *match)
buffer = _xdg_mime_magic_read_to_newline(magic_file, &end_of_file); buffer = _xdg_mime_magic_read_to_newline(magic_file, &end_of_file);
if (end_of_file) if (end_of_file)
{
free(buffer);
return XDG_MIME_MAGIC_EOF; return XDG_MIME_MAGIC_EOF;
}
end_ptr = buffer; end_ptr = buffer;
while (*end_ptr != ']' && *end_ptr != '\000' && *end_ptr != '\n') while (*end_ptr != ']' && *end_ptr != '\000' && *end_ptr != '\n')