Yang access function. Mem leak in USE_XML_INSERT
This commit is contained in:
parent
16de5f47ba
commit
e4239496a8
7 changed files with 45 additions and 23 deletions
|
|
@ -297,7 +297,9 @@ text_modify(clicon_handle h,
|
|||
}
|
||||
#ifdef USE_XML_INSERT
|
||||
/* Add new xml node but without parent - insert when node fully
|
||||
copied (see changed conditional below) */
|
||||
* copied (see changed conditional below)
|
||||
* Note x0 may dangle cases if exit before changed conditional
|
||||
*/
|
||||
if ((x0 = xml_new(x1name, NULL, (yang_stmt*)y0)) == NULL)
|
||||
goto done;
|
||||
#else
|
||||
|
|
@ -400,6 +402,11 @@ text_modify(clicon_handle h,
|
|||
#endif
|
||||
retval = 1;
|
||||
done:
|
||||
#ifdef USE_XML_INSERT
|
||||
/* Remove dangling added objects */
|
||||
if (changed && x0 && xml_parent(x0)==NULL)
|
||||
xml_purge(x0);
|
||||
#endif
|
||||
if (x0vec)
|
||||
free(x0vec);
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -934,9 +934,9 @@ xml_wrap(cxobj *xc,
|
|||
* @retval 0 OK
|
||||
* @retval -1
|
||||
* @note you cannot remove xchild in the loop (unless yoy keep track of xprev)
|
||||
*
|
||||
* @note Linear complexity - use xml_child_rm if possible
|
||||
* @see xml_free Free, dont remove from parent
|
||||
* @see xml_child_rm Only remove dont free
|
||||
* @see xml_child_rm Remove if child order is known (does not free)
|
||||
* Differs from xml_free it is removed from parent.
|
||||
*/
|
||||
int
|
||||
|
|
|
|||
|
|
@ -2867,6 +2867,26 @@ yang_apply(yang_stmt *yn,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Check if a node is a yang "data node"
|
||||
* @param[in] ys Yang statement node
|
||||
* @retval 0 Yang node is NOT a data node
|
||||
* @retval !=0 Yang node IS a data noed
|
||||
* @see RFC7950 Sec 3:
|
||||
* o data node: A node in the schema tree that can be instantiated in a
|
||||
* data tree. One of container, leaf, leaf-list, list, anydata, and
|
||||
* anyxml.
|
||||
*/
|
||||
int
|
||||
yang_datanode(yang_stmt *ys)
|
||||
{
|
||||
return (yang_keyword_get(ys) == Y_CONTAINER ||
|
||||
yang_keyword_get(ys) == Y_LEAF ||
|
||||
yang_keyword_get(ys) == Y_LIST ||
|
||||
yang_keyword_get(ys) == Y_LEAF_LIST ||
|
||||
yang_keyword_get(ys) == Y_ANYXML ||
|
||||
yang_keyword_get(ys) == Y_ANYDATA);
|
||||
}
|
||||
|
||||
/*! All the work for schema_nodeid functions both absolute and descendant
|
||||
* Ignore prefixes, see _abs
|
||||
* @param[in] yn Yang node. Find next yang stmt and return that if match.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue