Backport 0007-zhashx_purge-leak-when-shrinking.patch
Fixes memory leak in zhashx_purge when shrinking the hash table.
Luca Boccassi
6 years ago
|
0 |
czmq (4.0.2-7) UNRELEASED; urgency=medium
|
|
1 |
|
|
2 |
* Add 0007-zhashx_purge-leak-when-shrinking.patch backported from
|
|
3 |
upstream to fix memory leak in zhashx_purge when shrinking the table.
|
|
4 |
(Closes: #864342)
|
|
5 |
|
|
6 |
-- Luca Boccassi <luca.boccassi@gmail.com> Wed, 07 Jun 2017 10:10:28 +0100
|
|
7 |
|
0 | 8 |
czmq (4.0.2-6) unstable; urgency=medium
|
1 | 9 |
|
2 | 10 |
* Set version of symbols added by patch to 4.0.2-4~ to fix L:E
|
|
0 |
From 80624b71a112ff95e9f72ec379bca0c321d87623 Mon Sep 17 00:00:00 2001
|
|
1 |
From: Jim Klimov <jim@jimklimov.com>
|
|
2 |
Date: Thu, 1 Jun 2017 18:15:36 +0200
|
|
3 |
Subject: [PATCH] Problem: zhashx_purge() seems to leak when shrinking
|
|
4 |
|
|
5 |
Solution: freen() the old self->items before reassigning to the newly allocated smaller one
|
|
6 |
|
|
7 |
Signed-off-by: Jim Klimov <EvgenyKlimov@eaton.com>
|
|
8 |
---
|
|
9 |
src/zhashx.c | 1 +
|
|
10 |
1 file changed, 1 insertion(+)
|
|
11 |
|
|
12 |
diff --git a/src/zhashx.c b/src/zhashx.c
|
|
13 |
index 0631db14..bafab82b 100644
|
|
14 |
--- a/src/zhashx.c
|
|
15 |
+++ b/src/zhashx.c
|
|
16 |
@@ -395,6 +395,7 @@ zhashx_purge (zhashx_t *self)
|
|
17 |
size_t limit = primes [INITIAL_PRIME];
|
|
18 |
item_t **items = (item_t **) zmalloc (sizeof (item_t *) * limit);
|
|
19 |
assert (items);
|
|
20 |
+ free (self->items);
|
|
21 |
self->prime_index = INITIAL_PRIME;
|
|
22 |
self->chain_limit = INITIAL_CHAIN;
|
|
23 |
self->items = items;
|
|
24 |
--
|
|
25 |
2.11.0
|
|
26 |
|
3 | 3 |
0004-zpoller_remove-does-not-always-fail.patch
|
4 | 4 |
0005-zsys_shutdown-does-not-call-zmq_term.patch
|
5 | 5 |
0006-public-API-changes-depending-on-libzmq-version.patch
|
|
6 |
0007-zhashx_purge-leak-when-shrinking.patch
|