Skip to content

Commit

Permalink
expand stricter NULL check
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Sep 25, 2024
1 parent 772e01e commit 1bfe7a2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions cligen_expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,9 @@ tree_resolve(cligen_handle h,
treename = treename2;
}
/* Get parse tree header */
if ((ph = cligen_ph_find(h, treename)) == NULL){
if (fn && treename2==NULL){
goto ok;
}
else{
fprintf(stderr, "CLIgen tree '%s' not found\n", treename);
goto done;
}
if ((ph = cligen_ph_find(h, treename)) == NULL) {
fprintf(stderr, "CLIgen tree '%s' not found\n", treename);
goto done;
}
/* Get working point of tree, if any,
* and thereby the original tree (ptref)
Expand All @@ -282,7 +277,6 @@ tree_resolve(cligen_handle h,
*ptrefp = co_pt_get(cow);
else
*ptrefp = cligen_ph_parsetree_get(ph);
ok:
retval = 0;
done:
if (treename2)
Expand Down Expand Up @@ -360,6 +354,10 @@ co_expand_treeref_copy_shallow(cligen_handle h,
cvec *cvv = NULL;
cg_var *cv;

if (ptorig == NULL){
errno = EINVAL;
goto done;
}
coparent = co_up(co0);
for (i=0; i<pt_len_get(ptorig); i++){
if ((cot = pt_vec_i_get(ptorig, i)) == NULL)
Expand Down

0 comments on commit 1bfe7a2

Please sign in to comment.