1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 13:25:43 +02:00

Test return code of some malloc/strdup

This commit is contained in:
Sebastien Helleu
2009-02-23 13:45:30 +01:00
parent 70cfce2d2c
commit 426ab803cb
5 changed files with 428 additions and 232 deletions
+268 -163
View File
File diff suppressed because it is too large Load Diff
+7 -5
View File
@@ -960,13 +960,15 @@ config_weechat_key_write_cb (void *data, struct t_config_file *config_file,
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
expanded_name = gui_keyboard_get_expanded_name (ptr_key->key);
config_file_write_line (config_file,
(expanded_name) ?
expanded_name : ptr_key->key,
"\"%s\"",
ptr_key->command);
if (expanded_name)
{
config_file_write_line (config_file,
(expanded_name) ?
expanded_name : ptr_key->key,
"\"%s\"",
ptr_key->command);
free (expanded_name);
}
}
}
+56 -28
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+7 -5
View File
@@ -179,7 +179,11 @@ gui_keyboard_get_expanded_name (const char *key)
{
char *result;
if ((result = malloc ((strlen (key) * 5) + 1)))
if (!key)
return NULL;
result = malloc ((strlen (key) * 5) + 1);
if (result)
{
result[0] = '\0';
while (key[0])
@@ -206,9 +210,7 @@ gui_keyboard_get_expanded_name (const char *key)
}
}
}
else
return NULL;
return result;
}
@@ -354,7 +356,7 @@ gui_keyboard_search_part (struct t_gui_buffer *buffer, const char *key)
for (ptr_key = (buffer) ? buffer->keys : gui_keys; ptr_key;
ptr_key = ptr_key->next_key)
{
if (gui_keyboard_cmp (ptr_key->key, key) == 0)
if (ptr_key->key && (gui_keyboard_cmp (ptr_key->key, key) == 0))
return ptr_key;
}