dmentryjson.c: Fix use of uninitialized memory

next_obj wasn't initialized when the object number was zero.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
This commit is contained in:
Daniel Danzberger 2020-01-05 01:06:18 +01:00
parent 033380161d
commit f9a9896005

View file

@ -683,12 +683,12 @@ static void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, s
pobj[index].obj = obj_str;
//nextobj
if (obj_number != 0) {
if (obj_number != 0)
next_obj = dmcallocjson(obj_number+1, sizeof(struct dm_obj_s));
pobj[index].nextobj = next_obj;
} else {
pobj[index].nextobj = NULL;
}
else
next_obj = NULL;
pobj[index].nextobj = next_obj;
//leaf
if (param_number != 0) {