Skip to content

Commit

Permalink
tree schema BUGFIX check return val
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvasko committed May 24, 2024
1 parent 669345c commit eea767a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/tree_schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,20 +722,20 @@ lysc_path_until(const struct lysc_node *node, const struct lysc_node *parent, LY
s = predicates;

/* print key predicate */
asprintf(&predicates, "%s[%s='%%s']", s ? s : "", key->name);
if (s) {
if (asprintf(&predicates, "%s[%s='%%s']", s ? s : "", key->name) == -1) {
free(s);
free(path);
return NULL;
}
free(s);
}
s = buffer ? strdup(buffer) : path;
if (buffer) {
len = snprintf(buffer, buflen, "%s%s", predicates ? predicates : "", s ? s : "");
} else {
len = asprintf(&path, "%s%s", predicates ? predicates : "", s ? s : "");
}
if (predicates) {
free(predicates);
}
free(predicates);
free(s);

if (buffer && (buflen <= (size_t)len)) {
Expand Down

0 comments on commit eea767a

Please sign in to comment.