diff options
author | Jinfeng Wang <jinfeng.wang.cn@windriver.com> | 2025-04-09 11:13:07 +0800 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2025-04-20 13:43:55 -0400 |
commit | e42549cef364ae09b3b7c8b64bbeab32e50f1bb0 (patch) | |
tree | 4519ff3fbbd1f1cc500b2874cfb36d4e53e94a81 | |
parent | 77e91fceec324a17be4c186207000332f4f9c849 (diff) | |
download | meta-openembedded-kirkstone.tar.gz |
net-snmp: fix memory leakkirkstone-nextkirkstone
Backport patch [1] to fix memory leak by freeing tclist
[1] https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62
Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
-rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch | 32 | ||||
-rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb | 1 |
2 files changed, 33 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch new file mode 100644 index 0000000000..4e1d09e15a --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | From 606e2cbb2d607820345aa20d4095613b1f563a08 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jinfeng Wang <jinfeng.wang.cn@windriver.com> | ||
3 | Date: Wed, 9 Apr 2025 09:24:45 +0800 | ||
4 | Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist | ||
5 | |||
6 | tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd. | ||
7 | Remove the special character in the origin commit. | ||
8 | |||
9 | Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62] | ||
10 | |||
11 | Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com> | ||
12 | --- | ||
13 | snmplib/parse.c | 3 ++- | ||
14 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/snmplib/parse.c b/snmplib/parse.c | ||
17 | index 9406f4f88..2f9a20175 100644 | ||
18 | --- a/snmplib/parse.c | ||
19 | +++ b/snmplib/parse.c | ||
20 | @@ -4225,7 +4225,8 @@ unload_all_mibs(void) | ||
21 | if (ptc->description) | ||
22 | free(ptc->description); | ||
23 | } | ||
24 | - memset(tclist, 0, tc_alloc * sizeof(struct tc)); | ||
25 | + SNMP_FREE(tclist); | ||
26 | + tc_alloc = 0; | ||
27 | |||
28 | memset(buckets, 0, sizeof(buckets)); | ||
29 | memset(nbuckets, 0, sizeof(nbuckets)); | ||
30 | -- | ||
31 | 2.34.1 | ||
32 | |||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb index eb8e1599fb..88466c94b4 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb | |||
@@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ | |||
27 | file://reproducibility-have-printcap.patch \ | 27 | file://reproducibility-have-printcap.patch \ |
28 | file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ | 28 | file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ |
29 | file://CVE-2022-44792-CVE-2022-44793.patch \ | 29 | file://CVE-2022-44792-CVE-2022-44793.patch \ |
30 | file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \ | ||
30 | " | 31 | " |
31 | SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a" | 32 | SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a" |
32 | 33 | ||