Fixed almost all the leaks. One minor one is still lingering that I can't quite figure out.

SVN revision: 30555
This commit is contained in:
Nicholas Hughart 2007-07-03 05:46:54 +00:00
parent f9727d47ae
commit 94b2f0a24f
1 changed files with 18 additions and 10 deletions

View File

@ -690,7 +690,12 @@ efreet_mime_shared_mimeinfo_magic_load(const char *file)
{ {
if (buf[i] == '[') if (buf[i] == '[')
{ {
IF_FREE(entry); if(entry)
{
IF_FREE(entry->mask);
IF_FREE(entry->value);
FREE(entry);
}
last_section = i; last_section = i;
i++; i++;
@ -753,7 +758,6 @@ efreet_mime_shared_mimeinfo_magic_load(const char *file)
break; break;
case VALUE: case VALUE:
entry->value_len = 0;
if (efreet_mime_endianess == EFREET_ENDIAN_LITTLE) if (efreet_mime_endianess == EFREET_ENDIAN_LITTLE)
entry->value_len = ntohs(buf[i + 1] << 8 | (short)(buf[i])); entry->value_len = ntohs(buf[i + 1] << 8 | (short)(buf[i]));
else else
@ -839,22 +843,26 @@ efreet_mime_shared_mimeinfo_magic_load(const char *file)
if (mime) if (mime)
{ {
Efreet_Mime_Magic *m; Efreet_Mime_Magic *m;
m = ecore_list_goto_last(magics);
IF_FREE_LIST(mime->entries);
m = ecore_list_goto_last(magics);
if (m && !(strcmp(m->mime,mimetype))) if (m && !(strcmp(m->mime,mimetype)))
{ ecore_list_remove_destroy(magics);
efreet_mime_magic_free(m);
ecore_list_remove(magics); IF_FREE(mime);
}
FREE(mime);
} }
/* /*
* If we finished in the middle of an entry, make sure to * If we finished in the middle of an entry, make sure to
* clean it up as well. * clean it up as well.
*/ */
IF_FREE(entry); if(entry)
{
IF_FREE(entry->value);
IF_FREE(entry->mask);
IF_FREE(entry);
}
fseek(f, last_section-4096, SEEK_CUR); fseek(f, last_section-4096, SEEK_CUR);
break; break;