21 lines
709 B
Diff
21 lines
709 B
Diff
From f50dafc7d0bfd4f45449ab5665bfea831a82f2eb Mon Sep 17 00:00:00 2001
|
|
From: Alan Wang <948467222@qq.com>
|
|
Date: Thu, 26 Aug 2021 14:13:42 +0800
|
|
Subject: [PATCH] fix: potential memory leak in merge_patch() (#611)
|
|
|
|
---
|
|
cJSON_Utils.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/cJSON_Utils.c b/cJSON_Utils.c
|
|
index c7c64391..63651dfb 100644
|
|
--- a/cJSON_Utils.c
|
|
+++ b/cJSON_Utils.c
|
|
@@ -1367,6 +1367,7 @@ static cJSON *merge_patch(cJSON *target, const cJSON * const patch, const cJSON_
|
|
replacement = merge_patch(replace_me, patch_child, case_sensitive);
|
|
if (replacement == NULL)
|
|
{
|
|
+ cJSON_Delete(target);
|
|
return NULL;
|
|
}
|
|
|