mem problem in refine/augment code
This commit is contained in:
parent
d3c392b69d
commit
42a974bf78
2 changed files with 16 additions and 10 deletions
|
|
@ -2183,10 +2183,14 @@ yang_expand_grouping(yang_stmt *yn)
|
||||||
goto done;
|
goto done;
|
||||||
ygrouping->ys_flags |= YANG_FLAG_MARK; /* Mark as expanded */
|
ygrouping->ys_flags |= YANG_FLAG_MARK; /* Mark as expanded */
|
||||||
}
|
}
|
||||||
|
/* Make a copy of the grouping, then make refinements to this copy
|
||||||
|
*/
|
||||||
|
if ((ygrouping2 = ys_dup(ygrouping)) == NULL)
|
||||||
|
goto done;
|
||||||
/* Replace ys with ygrouping,...
|
/* Replace ys with ygrouping,...
|
||||||
* First enlarge parent vector
|
* First enlarge parent vector
|
||||||
*/
|
*/
|
||||||
glen = ygrouping->ys_len;
|
glen = ygrouping2->ys_len;
|
||||||
/*
|
/*
|
||||||
* yn is parent: the children of ygrouping replaces ys.
|
* yn is parent: the children of ygrouping replaces ys.
|
||||||
* Is there a case when glen == 0? YES AND THIS BREAKS
|
* Is there a case when glen == 0? YES AND THIS BREAKS
|
||||||
|
|
@ -2196,7 +2200,7 @@ yang_expand_grouping(yang_stmt *yn)
|
||||||
yn->ys_len += glen - 1;
|
yn->ys_len += glen - 1;
|
||||||
if (glen && (yn->ys_stmt = realloc(yn->ys_stmt, (yn->ys_len)*sizeof(yang_stmt *))) == 0){
|
if (glen && (yn->ys_stmt = realloc(yn->ys_stmt, (yn->ys_len)*sizeof(yang_stmt *))) == 0){
|
||||||
clicon_err(OE_YANG, errno, "realloc");
|
clicon_err(OE_YANG, errno, "realloc");
|
||||||
return -1;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Then move all existing elements up from i+1 (not uses-stmt) */
|
/* Then move all existing elements up from i+1 (not uses-stmt) */
|
||||||
if (size)
|
if (size)
|
||||||
|
|
@ -2205,11 +2209,7 @@ yang_expand_grouping(yang_stmt *yn)
|
||||||
size);
|
size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make a copy of the while grouping making it easier to
|
/* Iterate through refinements and modify grouping copy
|
||||||
* refine it */
|
|
||||||
if ((ygrouping2 = ys_dup(ygrouping)) == NULL)
|
|
||||||
goto done;
|
|
||||||
/* Iterate through refinments and modify grouping copy
|
|
||||||
* See RFC 7950 7.13.2 yrt is the refine target node
|
* See RFC 7950 7.13.2 yrt is the refine target node
|
||||||
*/
|
*/
|
||||||
yr = NULL;
|
yr = NULL;
|
||||||
|
|
@ -2241,6 +2241,9 @@ yang_expand_grouping(yang_stmt *yn)
|
||||||
}
|
}
|
||||||
/* Remove 'uses' node */
|
/* Remove 'uses' node */
|
||||||
ys_free(ys);
|
ys_free(ys);
|
||||||
|
/* Remove the grouping copy */
|
||||||
|
ygrouping2->ys_len = 0;
|
||||||
|
ys_free(ygrouping2);
|
||||||
break; /* Note same child is re-iterated since it may be changed */
|
break; /* Note same child is re-iterated since it may be changed */
|
||||||
default:
|
default:
|
||||||
i++;
|
i++;
|
||||||
|
|
@ -2600,8 +2603,8 @@ ys_schemanode_check(yang_stmt *ys,
|
||||||
if (yang_desc_schema_nodeid(yp, ys->ys_argument, -1, &yres) < 0)
|
if (yang_desc_schema_nodeid(yp, ys->ys_argument, -1, &yres) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (yres == NULL){
|
if (yres == NULL){
|
||||||
clicon_err(OE_YANG, 0, "schemanode sanity check of %d %s",
|
clicon_err(OE_YANG, 0, "schemanode sanity check of %s %s",
|
||||||
ys->ys_keyword,
|
yang_key2str(ys->ys_keyword),
|
||||||
ys->ys_argument);
|
ys->ys_argument);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
# Run valgrind leak test for cli, restconf, netconf or background.
|
# Run valgrind leak test for cli, restconf, netconf or background.
|
||||||
# Stop on first error
|
# Stop on first error
|
||||||
|
|
||||||
|
# Pattern to run tests
|
||||||
|
: ${pattern:=test_*.sh}
|
||||||
|
|
||||||
# Run valgrindtest once, args:
|
# Run valgrindtest once, args:
|
||||||
# what: (cli|netconf|restconf|backend)* # no args means all
|
# what: (cli|netconf|restconf|backend)* # no args means all
|
||||||
memonce(){
|
memonce(){
|
||||||
|
|
@ -45,7 +48,7 @@ memonce(){
|
||||||
esac
|
esac
|
||||||
|
|
||||||
err=0
|
err=0
|
||||||
for test in test_*.sh; do
|
for test in $pattern; do
|
||||||
if [ $testnr != 0 ]; then echo; fi
|
if [ $testnr != 0 ]; then echo; fi
|
||||||
testfile=$test
|
testfile=$test
|
||||||
. ./$test
|
. ./$test
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue