Merge pull request #225 from nowaits/master

Fixed memleak when setting string for none string cg_var type
This commit is contained in:
Olof Hagsand 2021-05-24 14:53:18 +02:00 committed by GitHub
commit d3b614e67d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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");