json_parse: Exit with error when reading the input fails

This commit is contained in:
panzhe committed 2026-09-09 11:52:42 +08:00
1 parent befb5a0b26
commit ea23279b75
1 file changed
+2
+2
View File
@@ -140,6 +140,8 @@ static int parseit(int fd, int (*callback)(struct json_object *))
if (ret < 0) if (ret < 0)
{ {
fprintf(stderr, "error reading fd %d: %s\n", fd, strerror(errno)); fprintf(stderr, "error reading fd %d: %s\n", fd, strerror(errno));
json_tokener_free(tok);
return 1;
} }
json_tokener_free(tok); json_tokener_free(tok);