diff options
author | Vivek Dasmohapatra <vivek@collabora.co.uk> | 2010-05-20 15:43:15 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-05-26 16:31:43 +0100 |
commit | d708686824f2ba70cf7c867752e9e52cb95f461b (patch) | |
tree | ea5faa60a188795a9a02015290e6859bd2939b1c | |
parent | cd48b089e962c9842c97545ad3cb91336a4be675 (diff) | |
download | telepathy-mission-control-d708686824f2ba70cf7c867752e9e52cb95f461b.tar.gz |
Coverity 7707 REVERSE_INULL two gchar ** deref'd w/o check in set_param
Also gchar ** strv_type_key potentially leaked in the 'clear' and 'unset' cases
(cherry picked from commit c4b90bf71b14da5a6c11bd7ef1898cd2734ffbab)
-rw-r--r-- | util/mc-tool.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/util/mc-tool.c b/util/mc-tool.c index 73a34497..315ef556 100644 --- a/util/mc-tool.c +++ b/util/mc-tool.c @@ -176,27 +176,34 @@ set_param (GHashTable *parameters, return FALSE; strv_type_key = g_strsplit (param_value, ":", 2); - if (strv_type_key[0] == NULL || - strv_type_key[1] == NULL || - strv_type_key[2] != NULL) - goto CLEANUP; + + if (strv_type_key == NULL || + strv_type_key[0] == NULL || + strv_type_key[1] == NULL || + strv_type_key[2] != NULL) + goto CLEANUP; + type = strv_type_key[0]; param = strv_type_key[1]; if (clear) { - if (strcmp (type, "clear") == 0 || strcmp (type, "unset") == 0) - { - g_ptr_array_add (clear, g_strdup (param)); - return TRUE; - } + if (strcmp (type, "clear") == 0 || strcmp (type, "unset") == 0) + { + g_ptr_array_add (clear, g_strdup (param)); + ret = TRUE; + goto CLEANUP; + } } strv_param_value = g_strsplit (param, "=", 2); - if (strv_param_value[0] == NULL || - strv_param_value[1] == NULL || - strv_param_value[2] != NULL) - goto CLEANUP; + + if (strv_param_value == NULL || + strv_param_value[0] == NULL || + strv_param_value[1] == NULL || + strv_param_value[2] != NULL) + goto CLEANUP; + key = strv_param_value[0]; value = strv_param_value[1]; @@ -234,9 +241,7 @@ set_param (GHashTable *parameters, g_free (gvalue); CLEANUP: - if (strv_param_value) g_strfreev (strv_param_value); - if (strv_type_key) g_strfreev (strv_type_key); return ret; } |