diff --git a/lib/clixon/clixon_xpath.h b/lib/clixon/clixon_xpath.h index 086903c8..ce62fc23 100644 --- a/lib/clixon/clixon_xpath.h +++ b/lib/clixon/clixon_xpath.h @@ -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, ...); diff --git a/lib/src/clixon_xpath.c b/lib/src/clixon_xpath.c index 7039c6de..0f0575e4 100644 --- a/lib/src/clixon_xpath.c +++ b/lib/src/clixon_xpath.c @@ -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; ixc_size; i++){ x = xr->xc_nodeset[i];