summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-09-30 12:13:00 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-09-30 12:13:00 +0200
commit9fa560300ff99bb6f57a0b8350da83d34cd60711 (patch)
tree0126cd1b4b02b8ad0906b8ef3797797b054318d4 /src/core
parentb4b1bf052269910ecc219725e4954ca8d5316bc0 (diff)
downloadweechat-9fa560300ff99bb6f57a0b8350da83d34cd60711.zip
Fix some memory leaks
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-config-file.c10
-rw-r--r--src/core/wee-hook.c4
2 files changed, 12 insertions, 2 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index a972cd5c6..67524806f 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -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;
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index d059c6d25..56861714f 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -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: