json-c/backport-fix-issue-854-Set-error-json_tokener_error_memory-in.patch

29 lines
800 B
Diff
Raw Normal View History

From e93ae70417867dac9ff87614f3e7bc50e79ef951 Mon Sep 17 00:00:00 2001
From: Eric Hawicz <erh+git@nimenees.com>
Date: Fri, 29 Mar 2024 18:09:12 -0400
Subject: [PATCH 093/100] Fix issue #854: Set error=json_tokener_error_memory
in json_tokener_parser_verbose() when allocating the tokener fails.
---
json_tokener.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/json_tokener.c b/json_tokener.c
index 9926563..e8244a3 100644
--- a/json_tokener.c
+++ b/json_tokener.c
@@ -226,7 +226,10 @@ struct json_object *json_tokener_parse_verbose(const char *str, enum json_tokene
tok = json_tokener_new();
if (!tok)
+ {
+ *error = json_tokener_error_memory;
return NULL;
+ }
obj = json_tokener_parse_ex(tok, str, -1);
*error = tok->err;
if (tok->err != json_tokener_success
--
2.33.0