xpath unitialized vecs

This commit is contained in:
Olof Hagsand 2018-07-20 10:02:35 +00:00
parent 912d1df853
commit e79e48b46f
2 changed files with 6 additions and 3 deletions

View file

@ -86,14 +86,14 @@ extern const map_str2int xpopmap[];
#if defined(__GNUC__) && __GNUC__ >= 3
int xpath_vec(cxobj *xcur, char *format, cxobj ***vec, size_t *veclen, ...) __attribute__ ((format (printf, 2, 5)));
int xpath_vec_flag(cxobj *xcur, char *format, uint16_t flags,
cxobj ***vec, size_t *veclen, ...) __attribute__ ((format (printf, 2, 6)));
cxobj ***vec, size_t *veclen, ...) __attribute__ ((format (printf, 2, 6)));
cxobj *xpath_first(cxobj *xcur, char *format, ...) __attribute__ ((format (printf, 2, 3)));
int xpath_vec_bool(cxobj *xcur, char *format, ...) __attribute__ ((format (printf, 2, 3)));
#else
int xpath_vec(cxobj *xcur, char *format, cxobj ***vec, size_t *veclen, ...);
int xpath_vec_flag(cxobj *xcur, char *format, uint16_t flags,
cxobj ***vec, size_t *veclen, ...);
cxobj ***vec, size_t *veclen, ...);
cxobj *xpath_first(cxobj *xcur, char *format, ...);
int xpath_vec_bool(cxobj *xcur, char *format, ...);

View file

@ -1192,6 +1192,8 @@ xpath_vec(cxobj *xcur,
goto done;
}
va_end(ap);
*vec=NULL;
*veclen = 0;
#ifdef COMPAT_XSL
if (xpath_vec_xsl(xcur, xpath, vec, veclen) < 0)
goto done;
@ -1270,13 +1272,14 @@ xpath_vec_flag(cxobj *xcur,
goto done;
}
va_end(ap);
*vec=NULL;
*veclen = 0;
#ifdef COMPAT_XSL
if (xpath_vec_flag_xsl(xcur, xpath, flags, vec, veclen) < 0)
goto done;
#else
if (xpath_vec_ctx(xcur, xpath, &xr) < 0)
goto done;
if (xr && xr->xc_type == XT_NODESET){
for (i=0; i<xr->xc_size; i++){
x = xr->xc_nodeset[i];