memleaks
This commit is contained in:
parent
7e109d1d4b
commit
a7af7e7593
4 changed files with 20 additions and 19 deletions
|
|
@ -663,7 +663,7 @@ cli_show_auto1(clicon_handle h,
|
||||||
char *api_path_fmt; /* xml key format */
|
char *api_path_fmt; /* xml key format */
|
||||||
// char *api_path = NULL; /* xml key */
|
// char *api_path = NULL; /* xml key */
|
||||||
char *db;
|
char *db;
|
||||||
char *xpath;
|
char *xpath = NULL;
|
||||||
char *formatstr;
|
char *formatstr;
|
||||||
enum format_enum format = FORMAT_XML;
|
enum format_enum format = FORMAT_XML;
|
||||||
cxobj *xt = NULL;
|
cxobj *xt = NULL;
|
||||||
|
|
@ -744,6 +744,8 @@ cli_show_auto1(clicon_handle h,
|
||||||
}
|
}
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
|
if (xpath)
|
||||||
|
free(xpath);
|
||||||
if (xt)
|
if (xt)
|
||||||
xml_free(xt);
|
xml_free(xt);
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
||||||
|
|
@ -917,9 +917,10 @@ xml_wrap_all(cxobj *xp,
|
||||||
/*! Wrap a new element above a single xml node (xc) with new tag
|
/*! Wrap a new element above a single xml node (xc) with new tag
|
||||||
* Before: xp --> xc # specific child (xp can be NULL)
|
* Before: xp --> xc # specific child (xp can be NULL)
|
||||||
* After: xp --> xt(tag) --> xc
|
* After: xp --> xt(tag) --> xc
|
||||||
* @param[in] xp Parent xml node
|
* @param[in] xp Parent xml node
|
||||||
* @param[in] tag Name of new xml child
|
* @param[in] tag Name of new xml child
|
||||||
* @retval xc Return the new child (xc)
|
* @retval NULL Error
|
||||||
|
* @retval xc Return the new child (xc)
|
||||||
* @see xml_addsub (give the parent)
|
* @see xml_addsub (give the parent)
|
||||||
* @see xml_wrap_all (wrap all children of a node, not just one)
|
* @see xml_wrap_all (wrap all children of a node, not just one)
|
||||||
*/
|
*/
|
||||||
|
|
@ -1038,7 +1039,7 @@ xml_rm(cxobj *xc)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Return a child sub-tree, while removing parent and all other children
|
/*! Remove top XML object and all children except a single child
|
||||||
* Given a root xml node, and the i:th child, remove the child from its parent
|
* Given a root xml node, and the i:th child, remove the child from its parent
|
||||||
* and return it, remove the parent and all other children. (unwrap)
|
* and return it, remove the parent and all other children. (unwrap)
|
||||||
* Before: xp-->[..xc..]
|
* Before: xp-->[..xc..]
|
||||||
|
|
@ -1086,7 +1087,7 @@ xml_rootchild(cxobj *xp,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Return a child sub-tree, while removing parent and all other children
|
/*! Remove top XML object and all children except a single (given) child
|
||||||
* Given a root xml node, remove the child from its parent
|
* Given a root xml node, remove the child from its parent
|
||||||
* , remove the parent and all other children. (unwrap)
|
* , remove the parent and all other children. (unwrap)
|
||||||
* Before: xp-->[..xc..]
|
* Before: xp-->[..xc..]
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ yang_modules_state_get(clicon_handle h,
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
cxobj *x = NULL; /* Top tree, some juggling w top symbol */
|
cxobj *x = NULL; /* Top tree, some juggling w top symbol */
|
||||||
char *msid; /* modules-set-id */
|
char *msid; /* modules-set-id */
|
||||||
cxobj *x1;
|
cxobj *xc; /* original cache */
|
||||||
cbuf *cb = NULL;
|
cbuf *cb = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
cxobj **xvec = NULL;
|
cxobj **xvec = NULL;
|
||||||
|
|
@ -295,20 +295,18 @@ yang_modules_state_get(clicon_handle h,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
msid = clicon_option_str(h, "CLICON_MODULE_SET_ID");
|
msid = clicon_option_str(h, "CLICON_MODULE_SET_ID");
|
||||||
if ((x = clicon_modst_cache_get(h, brief)) != NULL){
|
if ((xc = clicon_modst_cache_get(h, brief)) != NULL){
|
||||||
/* x is here: <modules-state>...
|
cxobj *xw; /* tmp top wrap object */
|
||||||
* and x is original tree, need to copy */
|
/* xc is here: <modules-state>...
|
||||||
if ((x = xml_wrap(x, "top")) < 0)
|
* need to wrap it for xpath: <top><modules-state> */
|
||||||
|
/* xc is also original tree, need to copy it */
|
||||||
|
if ((xw = xml_wrap(xc, "top")) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (xpath_first(x, "%s", xpath)){
|
if (xpath_first(xw, "%s", xpath)){
|
||||||
if ((x1 = xml_dup(x)) == NULL)
|
if ((x = xml_dup(xc)) == NULL) /* Make copy and use below */
|
||||||
goto done;
|
goto done;
|
||||||
x = x1;
|
|
||||||
}
|
}
|
||||||
else
|
if (xml_rootchild_node(xw, xc) < 0) /* Unwrap x / free xw */
|
||||||
x = NULL;
|
|
||||||
/* unwrap */
|
|
||||||
if (x && xml_rootchild(x, 0, &x) < 0)
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else { /* No cache -> build the tree */
|
else { /* No cache -> build the tree */
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ new "restconf delete $perfreq small config"
|
||||||
rnd=$(( ( RANDOM % $perfnr ) ))
|
rnd=$(( ( RANDOM % $perfnr ) ))
|
||||||
curl -s -X DELETE http://localhost/restconf/data/scaling:x/y=$rnd
|
curl -s -X DELETE http://localhost/restconf/data/scaling:x/y=$rnd
|
||||||
done > /dev/null; } 2>&1 | awk '/real/ {print $2}'
|
done > /dev/null; } 2>&1 | awk '/real/ {print $2}'
|
||||||
exit
|
|
||||||
# Now do leaf-lists istead of leafs
|
# Now do leaf-lists istead of leafs
|
||||||
|
|
||||||
new "generate large leaf-list config"
|
new "generate large leaf-list config"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue