1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

Fix some memory leaks

This commit is contained in:
Sebastien Helleu
2008-09-30 12:13:00 +02:00
parent b4b1bf0522
commit 9fa560300f
8 changed files with 50 additions and 11 deletions
+8 -2
View File
@@ -101,8 +101,14 @@ config_file_new (struct t_weechat_plugin *plugin, const char *name,
new_config_file->name = strdup (name);
length = strlen (name) + 8 + 1;
filename = malloc (length);
snprintf (filename, length, "%s.conf", name);
new_config_file->filename = strdup (filename);
if (filename)
{
snprintf (filename, length, "%s.conf", name);
new_config_file->filename = strdup (filename);
free (filename);
}
else
new_config_file->filename = strdup (name);
new_config_file->file = NULL;
new_config_file->callback_reload = callback_reload;
new_config_file->callback_reload_data = callback_reload_data;
+4
View File
@@ -1594,11 +1594,15 @@ unhook (struct t_hook *hook)
case HOOK_TYPE_INFO:
if (HOOK_INFO(hook, info_name))
free (HOOK_INFO(hook, info_name));
if (HOOK_INFO(hook, description))
free (HOOK_INFO(hook, description));
free ((struct t_hook_info *)hook->hook_data);
break;
case HOOK_TYPE_INFOLIST:
if (HOOK_INFOLIST(hook, infolist_name))
free (HOOK_INFOLIST(hook, infolist_name));
if (HOOK_INFOLIST(hook, description))
free (HOOK_INFOLIST(hook, description));
free ((struct t_hook_infolist *)hook->hook_data);
break;
case HOOK_NUM_TYPES: