From b8e07049a8ee684eaa8df48bef6e7bfbc853644d Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Wed, 14 Feb 2024 17:31:12 -0500 Subject: [PATCH] lib: fix memleak on success Signed-off-by: Christian Hopps --- lib/yang.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/yang.c b/lib/yang.c index ff7df0b379..8a2abfaf01 100644 --- a/lib/yang.c +++ b/lib/yang.c @@ -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, &tree, NULL); + ly_in_free(in, 0); if (err) { zlog_err("Failed to parse notification: %s", ly_last_errmsg()); - ly_in_free(in, 0); return err; } @@ -751,7 +751,6 @@ LY_ERR yang_parse_notification(LYD_FORMAT format, const char *data, if (!found) { zlog_err("Notification not found in the parsed tree"); lyd_free_all(tree); - ly_in_free(in, 0); return LY_ENOTFOUND; }