dfilter: use g_malloc0 to prevent uninitialized memory to be used.
authorDario Lombardo <lomato@gmail.com>
Sun, 18 Feb 2018 17:36:49 +0000 (18:36 +0100)
committerAnders Broman <a.broman58@gmail.com>
Wed, 21 Feb 2018 17:14:30 +0000 (17:14 +0000)
Found by clang.

Change-Id: I89497bd0f32c79f82218c6d254a214364c930eb3
Reviewed-on: https://code.wireshark.org/review/25884
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dfilter/gencode.c

index 7554e6e7f67c3dfcb4f6b4a6e13148bff9f26597..769fcc314311db1c903d31095c379f03da554fb2 100644 (file)
@@ -169,7 +169,7 @@ dfw_append_function(dfwork_t *dfw, stnode_t *node, dfvm_value_t **p_jmp)
 
        /* Array to hold the instructions that need to jump to
         * an instruction if they fail. */
-       jmps = (dfvm_value_t **)g_malloc(num_params * sizeof(dfvm_value_t*));
+       jmps = (dfvm_value_t **)g_malloc0(num_params * sizeof(dfvm_value_t*));
 
        /* Create the new DFVM instruction */
        insn = dfvm_insn_new(CALL_FUNCTION);
@@ -185,7 +185,6 @@ dfw_append_function(dfwork_t *dfw, stnode_t *node, dfvm_value_t **p_jmp)
 
        i = 0;
        while (params) {
-               jmps[i] = NULL;
                reg = gen_entity(dfw, (stnode_t *)params->data, &jmps[i]);
 
                val = dfvm_value_new(REGISTER);