diff options
author | Alexander Smirnov <alex@ydb.tech> | 2025-04-26 16:37:54 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2025-04-26 16:37:54 +0000 |
commit | 8f6d662e582affc5bbbd9f663c7b8e5b99815c5b (patch) | |
tree | ba7df792788fa5a15837a5ffed1d6b5eee1dcb7d /contrib/libs | |
parent | 290386cb0f1392f0619a1452963743fcf194ced2 (diff) | |
parent | ad35ebc195a5fdc57eae37a2a666a977edc29b35 (diff) | |
download | ydb-8f6d662e582affc5bbbd9f663c7b8e5b99815c5b.tar.gz |
Merge pull request #17754 from ydb-platform/merge-libs-250425-1915
Diffstat (limited to 'contrib/libs')
-rw-r--r-- | contrib/libs/yajl/patch/fix_memory_leak.patch | 26 | ||||
-rw-r--r-- | contrib/libs/yajl/patch/uint64_support_r767862_review16855.patch (renamed from contrib/libs/yajl/uint64_support_r767862_review16855.patch) | 0 | ||||
-rw-r--r-- | contrib/libs/yajl/yajl_tree.c | 9 |
3 files changed, 34 insertions, 1 deletions
diff --git a/contrib/libs/yajl/patch/fix_memory_leak.patch b/contrib/libs/yajl/patch/fix_memory_leak.patch new file mode 100644 index 00000000000..0ac5f0f3914 --- /dev/null +++ b/contrib/libs/yajl/patch/fix_memory_leak.patch @@ -0,0 +1,26 @@ +--- contrib/libs/yajl/yajl_tree.c (3b4a018b6b389390da3ee13f6b4ce0880cb71807) ++++ contrib/libs/yajl/yajl_tree.c (5fe0776c5f96630ddffb63e4ff0292037e12039e) +@@ -143,7 +143,7 @@ static yajl_val context_pop(context_t *ctx) + ctx->stack = stack->next; + + v = stack->value; +- ++ free (stack->key); + free (stack); + + return (v); +@@ -453,7 +453,14 @@ yajl_val yajl_tree_parse (const char *input, + (const unsigned char *) input, + strlen(input))); + } ++ while(ctx.stack != NULL) { ++ yajl_val v = context_pop(&ctx); ++ yajl_tree_free(v); ++ } + yajl_free (handle); ++ //If the requested memory is not released in time, it will cause memory leakage ++ if(ctx.root) ++ yajl_tree_free(ctx.root); + return NULL; + } + diff --git a/contrib/libs/yajl/uint64_support_r767862_review16855.patch b/contrib/libs/yajl/patch/uint64_support_r767862_review16855.patch index 62da2521b0f..62da2521b0f 100644 --- a/contrib/libs/yajl/uint64_support_r767862_review16855.patch +++ b/contrib/libs/yajl/patch/uint64_support_r767862_review16855.patch diff --git a/contrib/libs/yajl/yajl_tree.c b/contrib/libs/yajl/yajl_tree.c index c5874e660e0..6a9d9ffb1b5 100644 --- a/contrib/libs/yajl/yajl_tree.c +++ b/contrib/libs/yajl/yajl_tree.c @@ -143,7 +143,7 @@ static yajl_val context_pop(context_t *ctx) ctx->stack = stack->next; v = stack->value; - + free (stack->key); free (stack); return (v); @@ -453,7 +453,14 @@ yajl_val yajl_tree_parse (const char *input, (const unsigned char *) input, strlen(input))); } + while(ctx.stack != NULL) { + yajl_val v = context_pop(&ctx); + yajl_tree_free(v); + } yajl_free (handle); + //If the requested memory is not released in time, it will cause memory leakage + if(ctx.root) + yajl_tree_free(ctx.root); return NULL; } |