From ea23279b752803d389603f91fdb4eeedb37e93d4 Mon Sep 17 00:00:00 2001 From: panzhe Date: Wed, 9 Sep 2026 11:52:42 +0800 Subject: [PATCH] json_parse: Exit with error when reading the input fails --- apps/json_parse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/json_parse.c b/apps/json_parse.c index ebb0f25..f1222fe 100644 --- a/apps/json_parse.c +++ b/apps/json_parse.c @@ -140,6 +140,8 @@ static int parseit(int fd, int (*callback)(struct json_object *)) if (ret < 0) { fprintf(stderr, "error reading fd %d: %s\n", fd, strerror(errno)); + json_tokener_free(tok); + return 1; } json_tokener_free(tok);