Fixed memleak when setting string for none string cg_var type

This commit is contained in:
jxm 2021-05-19 20:37:00 +08:00
parent 9fb9024675
commit 2e71cdbab7

View file

@ -2885,6 +2885,8 @@ yang_abs_schema_nodeid(yang_stmt *yn,
/* If p0 is NULL an entry will be: [i0] which needs to be transformed to [NULL:i0] */
cv = NULL;
while ((cv = cvec_each(nodeid_cvv, cv)) != NULL){
if (cv_type_get(cv) != CGV_STRING)
cv_type_set(cv, CGV_STRING);
if ((str = cv_string_get(cv)) == NULL || !strlen(str)){
if (cv_string_set(cv, cv_name_get(cv)) < 0){
clicon_err(OE_UNIX, errno, "cv_string_set");