diff options
author | Hadriel Kaplan <hadrielk@yahoo.com> | 2014-02-25 12:57:52 -0500 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2014-02-27 21:23:32 +0000 |
commit | 655f2e4dd4c520ff40427af85034860d13103e58 (patch) | |
tree | 5b029030a866857b0b638be8a912e2bffdc5f200 /epan | |
parent | c826191be02132251a9bd7cdaa44647b24bfce95 (diff) |
Fix prefs.c: Argument with 'nonnull' attribute passed null (redux)
Change-Id: I795df36039278283008132d647aaf51e76dbe218
Reviewed-on: https://code.wireshark.org/review/424
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/prefs.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index 73bc2322f2..cf9b3da801 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -3605,6 +3605,7 @@ prefs_is_column_visible(const gchar *cols_hidden, fmt_data *cfmt) if (cfmt->fmt != cfmt_hidden.fmt) { /* No. */ g_free(cfmt_hidden.custom_field); + cfmt_hidden.custom_field = NULL; continue; } if (cfmt->fmt == COL_CUSTOM) { @@ -3612,16 +3613,20 @@ prefs_is_column_visible(const gchar *cols_hidden, fmt_data *cfmt) * A custom column has to have the * same custom field and occurrence. */ - if (strcmp(cfmt->custom_field, - cfmt_hidden.custom_field) != 0) { - /* Different fields. */ - g_free(cfmt_hidden.custom_field); - continue; - } - if (cfmt->custom_occurrence != cfmt_hidden.custom_occurrence) { - /* Different occurrences. */ - g_free(cfmt_hidden.custom_field); - continue; + if (cfmt_hidden.custom_field && cfmt->custom_field) { + if (strcmp(cfmt->custom_field, + cfmt_hidden.custom_field) != 0) { + /* Different fields. */ + g_free(cfmt_hidden.custom_field); + cfmt_hidden.custom_field = NULL; + continue; + } + if (cfmt->custom_occurrence != cfmt_hidden.custom_occurrence) { + /* Different occurrences. */ + g_free(cfmt_hidden.custom_field); + cfmt_hidden.custom_field = NULL; + continue; + } } } |