uninitialized nvalvec

This commit is contained in:
Olof Hagsand 2019-08-03 15:17:58 +01:00
parent 1fe7d916f4
commit 1665f1f414

View file

@ -2612,7 +2612,7 @@ api_path2xml_vec(char **vec,
cg_var *cvi; cg_var *cvi;
char *keyname; char *keyname;
char **valvec = NULL; char **valvec = NULL;
int nvalvec; int nvalvec = 0;
int vi; int vi;
cxobj *x = NULL; cxobj *x = NULL;
yang_stmt *y = NULL; yang_stmt *y = NULL;
@ -2713,11 +2713,12 @@ api_path2xml_vec(char **vec,
goto done; goto done;
xml_type_set(xn, CX_ELMNT); xml_type_set(xn, CX_ELMNT);
if ((xb = xml_new("body", xn, NULL)) == NULL) if ((xb = xml_new("body", xn, NULL)) == NULL)
goto done; goto done;
xml_type_set(xb, CX_BODY); xml_type_set(xb, CX_BODY);
if (vi < nvalvec) if (vi++ < nvalvec){
if (xml_value_set(xb, valvec[vi++]) < 0) if (xml_value_set(xb, valvec[vi-1]) < 0)
goto done; goto done;
}
} }
break; break;
default: /* eg Y_CONTAINER, Y_LEAF */ default: /* eg Y_CONTAINER, Y_LEAF */