]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fix memleak on success
authorChristian Hopps <chopps@labn.net>
Wed, 14 Feb 2024 22:31:12 +0000 (17:31 -0500)
committerChristian Hopps <chopps@labn.net>
Thu, 15 Feb 2024 11:13:08 +0000 (06:13 -0500)
Signed-off-by: Christian Hopps <chopps@labn.net>
lib/yang.c

index ff7df0b379bc088b3812897c6fafc05828c270f1..8a2abfaf0160cb0a3cc0e3b7f9fc46e3e58d81a8 100644 (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,
                           &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;
        }