lib: fix memleak on success

Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
Christian Hopps 2024-02-14 17:31:12 -05:00
parent 2fd5e51d4c
commit b8e07049a8

View file

@ -730,9 +730,9 @@ LY_ERR yang_parse_notification(LYD_FORMAT format, const char *data,
err = lyd_parse_op(ly_native_ctx, NULL, in, format, LYD_TYPE_NOTIF_YANG, err = lyd_parse_op(ly_native_ctx, NULL, in, format, LYD_TYPE_NOTIF_YANG,
&tree, NULL); &tree, NULL);
ly_in_free(in, 0);
if (err) { if (err) {
zlog_err("Failed to parse notification: %s", ly_last_errmsg()); zlog_err("Failed to parse notification: %s", ly_last_errmsg());
ly_in_free(in, 0);
return err; return err;
} }
@ -751,7 +751,6 @@ LY_ERR yang_parse_notification(LYD_FORMAT format, const char *data,
if (!found) { if (!found) {
zlog_err("Notification not found in the parsed tree"); zlog_err("Notification not found in the parsed tree");
lyd_free_all(tree); lyd_free_all(tree);
ly_in_free(in, 0);
return LY_ENOTFOUND; return LY_ENOTFOUND;
} }