All of lore.kernel.org
 help / color / mirror / Atom feed
* [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
@ 2025-02-20  2:27 jinfeng.wang.cn
  0 siblings, 0 replies; 10+ messages in thread
From: jinfeng.wang.cn @ 2025-02-20  2:27 UTC (permalink / raw)
  To: openembedded-devel

From: Jinfeng Wang <jinfeng.wang.cn@windriver.com>

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>
---
 ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++
 .../net-snmp/net-snmp_5.9.3.bb                |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch

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..3632881501
--- /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,40 @@
+From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001
+From: JanSoundhouse <jan.sondhauss@wago.com>
+Date: Mon, 5 Sep 2022 11:25:58 +0200
+Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist
+
+tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd.
+
+Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62]
+
+Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
+---
+ snmplib/parse.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/snmplib/parse.c b/snmplib/parse.c
+index b3e2f3ae5c..71bdf75ff8 100644
+--- a/snmplib/parse.c
++++ b/snmplib/parse.c
+@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ SOFTWARE.
+ ******************************************************************/
+ /*
+- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+  * Use is subject to license terms specified in the COPYING file
+  * distributed with the Net-SNMP package.
+  */
+@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
+         if (ptc->description)
+             free(ptc->description);
+     }
+-    memset(tclist, 0, tc_alloc * sizeof(struct tc));
++    SNMP_FREE(tclist);
++    tc_alloc = 0;
+ 
+     memset(buckets, 0, sizeof(buckets));
+     memset(nbuckets, 0, sizeof(nbuckets));
+-- 
+2.34.1
+
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 \
            file://reproducibility-have-printcap.patch \
            file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \
            file://CVE-2022-44792-CVE-2022-44793.patch \
+           file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \
            "
 SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
       [not found] <1825C99274128577.23135@lists.openembedded.org>
@ 2025-03-10  7:01 ` Wang, Jinfeng (CN)
  2025-03-10  9:29   ` Piotr L Lewicki
  0 siblings, 1 reply; 10+ messages in thread
From: Wang, Jinfeng (CN) @ 2025-03-10  7:01 UTC (permalink / raw)
  To: openembedded-devel, akuster808

Sorry for interupt.

Please revert my patch.


After I rebase the latest codes from kirkstone. I found my patch had a 
bad character. This caused net-snmp do_patch failure.

After some tries, I still failed to resolve this.


The cherry-pick in my side picked copyright change. But after sending 
the patch via git send-mail, the character changed.

Sorry again.


Thanks.

Jinfeng


On 2/20/2025 10:27 AM, Wang, Jinfeng (CN) via lists.openembedded.org wrote:
> From: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>
> 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>
> ---
>   ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++
>   .../net-snmp/net-snmp_5.9.3.bb                |  1 +
>   2 files changed, 41 insertions(+)
>   create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch
>
> 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..3632881501
> --- /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,40 @@
> +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001
> +From: JanSoundhouse <jan.sondhauss@wago.com>
> +Date: Mon, 5 Sep 2022 11:25:58 +0200
> +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist
> +
> +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd.
> +
> +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62]
> +
> +Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
> +---
> + snmplib/parse.c | 5 +++--
> + 1 file changed, 3 insertions(+), 2 deletions(-)
> +
> +diff --git a/snmplib/parse.c b/snmplib/parse.c
> +index b3e2f3ae5c..71bdf75ff8 100644
> +--- a/snmplib/parse.c
> ++++ b/snmplib/parse.c
> +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
> + SOFTWARE.
> + ******************************************************************/
> + /*
> +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
> ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
> +  * Use is subject to license terms specified in the COPYING file
> +  * distributed with the Net-SNMP package.
> +  */
> +@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
> +         if (ptc->description)
> +             free(ptc->description);
> +     }
> +-    memset(tclist, 0, tc_alloc * sizeof(struct tc));
> ++    SNMP_FREE(tclist);
> ++    tc_alloc = 0;
> +
> +     memset(buckets, 0, sizeof(buckets));
> +     memset(nbuckets, 0, sizeof(nbuckets));
> +--
> +2.34.1
> +
> 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 \
>              file://reproducibility-have-printcap.patch \
>              file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \
>              file://CVE-2022-44792-CVE-2022-44793.patch \
> +           file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \
>              "
>   SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"
>   
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#115527): https://lists.openembedded.org/g/openembedded-devel/message/115527
> Mute This Topic: https://lists.openembedded.org/mt/111282761/8617462
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [Jinfeng.Wang.CN@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
  2025-03-10  7:01 ` [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak Wang, Jinfeng (CN)
@ 2025-03-10  9:29   ` Piotr L Lewicki
  2025-03-10 10:56     ` Gyorgy Sarvari
  0 siblings, 1 reply; 10+ messages in thread
From: Piotr L Lewicki @ 2025-03-10  9:29 UTC (permalink / raw)
  To: openembedded-devel@lists.openembedded.org, akuster808@gmail.com,
	Jinfeng.Wang.CN@windriver.com

From: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <Jinfeng.Wang.CN=windriver.com@lists.openembedded.org>
Sent: Monday, March 10, 2025 08:01
To: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org>; akuster808@gmail.com <akuster808@gmail.com>
Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak

[You don't often get email from jinfeng.wang.cn=windriver.com@lists.openembedded.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Warning

This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments.
If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
See the SecureWay group in Yammer for more security information.

Sorry for interupt.

Please revert my patch.


After I rebase the latest codes from kirkstone. I found my patch had a
bad character. This caused net-snmp do_patch failure.

After some tries, I still failed to resolve this.


The cherry-pick in my side picked copyright change. But after sending
the patch via git send-mail, the character changed.

Sorry again.


Thanks.

Jinfeng


On 2/20/2025 10:27 AM, Wang, Jinfeng (CN) via lists.openembedded.org wrote:
> From: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>
> 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>
> ---
>   ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++
>   .../net-snmp/net-snmp_5.9.3.bb                |  1 +
>   2 files changed, 41 insertions(+)
>   create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch
>
> 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..3632881501
> --- /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,40 @@
> +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001
> +From: JanSoundhouse <jan.sondhauss@wago.com>
> +Date: Mon, 5 Sep 2022 11:25:58 +0200
> +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist
> +
> +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd.
> +
> +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62]
> +
> +Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
> +---
> + snmplib/parse.c | 5 +++--
> + 1 file changed, 3 insertions(+), 2 deletions(-)
> +
> +diff --git a/snmplib/parse.c b/snmplib/parse.c
> +index b3e2f3ae5c..71bdf75ff8 100644
> +--- a/snmplib/parse.c
> ++++ b/snmplib/parse.c
> +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
> + SOFTWARE.
> + ******************************************************************/
> + /*
> +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
> ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
> +  * Use is subject to license terms specified in the COPYING file
> +  * distributed with the Net-SNMP package.
> +  */
> +@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
> +         if (ptc->description)
> +             free(ptc->description);
> +     }
> +-    memset(tclist, 0, tc_alloc * sizeof(struct tc));
> ++    SNMP_FREE(tclist);
> ++    tc_alloc = 0;
> +
> +     memset(buckets, 0, sizeof(buckets));
> +     memset(nbuckets, 0, sizeof(nbuckets));
> +--
> +2.34.1
> +
> 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 \
>              file://reproducibility-have-printcap.patch \
>              file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \
>              file://CVE-2022-44792-CVE-2022-44793.patch \
> +           file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \
>              "
>   SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"
>
>
>
>

Hello,
The 0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch file needs to be slightly adapted to be working.
See my patch below:

From 54ba004a7c12cddcbcb020878fb03bbf52db2855 Mon Sep 17 00:00:00 2001
From: Piotr Lewicki <piotr.l.lewicki@hitachienergy.com>
Date: Mon, 10 Mar 2025 10:18:27 +0100
Subject: [meta-oe][kirkstone][PATCH] net-snmp: Adapt patch that fixes memory
 leak

In commit d0c2a3d383dac9fe7e85b7d87784b7f5b5c62c5e the patch that fixes
a memory leak has been backported to kirkstone branch, but it was not
adapted. This commit adapts the patch to apply properly on this branch.

Signed-off-by: Piotr Lewicki <piotr.l.lewicki@hitachienergy.com>
---
 ...all_mibs-fix-memory-leak-by-freeing-tclist.patch | 13 ++-----------
 1 file changed, 2 insertions(+), 11 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
index cc498c7fc9..39f8ba1d61 100644
--- 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
@@ -13,19 +13,10 @@ Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
  1 file changed, 3 insertions(+), 2 deletions(-)

 diff --git a/snmplib/parse.c b/snmplib/parse.c
-index b3e2f3ae5c..71bdf75ff8 100644
+index 9406f4f..2f9a201 100644
 --- a/snmplib/parse.c
 +++ b/snmplib/parse.c
-@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- SOFTWARE.
- ******************************************************************/
- /*
-- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
-+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
-  * Use is subject to license terms specified in the COPYING file
-  * distributed with the Net-SNMP package.
-  */
-@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
+@@ -4225,7 +4225,8 @@ unload_all_mibs(void)
          if (ptc->description)
              free(ptc->description);
      }
--
2.34.1



Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
________________________________
Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
  2025-03-10  9:29   ` Piotr L Lewicki
@ 2025-03-10 10:56     ` Gyorgy Sarvari
  2025-03-11  6:46       ` Wang, Jinfeng (CN)
  0 siblings, 1 reply; 10+ messages in thread
From: Gyorgy Sarvari @ 2025-03-10 10:56 UTC (permalink / raw)
  To: piotr.l.lewicki, openembedded-devel@lists.openembedded.org,
	akuster808@gmail.com, Jinfeng.Wang.CN@windriver.com

That character change in the comment doesn't look material for the fix
to take effect, it could be even left out of the backport completely.

On 10.03.25 10:29, Piotr L Lewicki via lists.openembedded.org wrote:
> From: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <Jinfeng.Wang.CN=windriver.com@lists.openembedded.org>
> Sent: Monday, March 10, 2025 08:01
> To: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org>; akuster808@gmail.com <akuster808@gmail.com>
> Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
>
> [You don't often get email from jinfeng.wang.cn=windriver.com@lists.openembedded.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Warning
>
> This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments.
> If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
> See the SecureWay group in Yammer for more security information.
>
> Sorry for interupt.
>
> Please revert my patch.
>
>
> After I rebase the latest codes from kirkstone. I found my patch had a
> bad character. This caused net-snmp do_patch failure.
>
> After some tries, I still failed to resolve this.
>
>
> The cherry-pick in my side picked copyright change. But after sending
> the patch via git send-mail, the character changed.
>
> Sorry again.
>
>
> Thanks.
>
> Jinfeng
>
>
> On 2/20/2025 10:27 AM, Wang, Jinfeng (CN) via lists.openembedded.org wrote:
>> From: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>>
>> 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>
>> ---
>>   ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++
>>   .../net-snmp/net-snmp_5.9.3.bb                |  1 +
>>   2 files changed, 41 insertions(+)
>>   create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch
>>
>> 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..3632881501
>> --- /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,40 @@
>> +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001
>> +From: JanSoundhouse <jan.sondhauss@wago.com>
>> +Date: Mon, 5 Sep 2022 11:25:58 +0200
>> +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist
>> +
>> +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd.
>> +
>> +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62]
>> +
>> +Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>> +---
>> + snmplib/parse.c | 5 +++--
>> + 1 file changed, 3 insertions(+), 2 deletions(-)
>> +
>> +diff --git a/snmplib/parse.c b/snmplib/parse.c
>> +index b3e2f3ae5c..71bdf75ff8 100644
>> +--- a/snmplib/parse.c
>> ++++ b/snmplib/parse.c
>> +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
>> + SOFTWARE.
>> + ******************************************************************/
>> + /*
>> +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
>> ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
>> +  * Use is subject to license terms specified in the COPYING file
>> +  * distributed with the Net-SNMP package.
>> +  */
>> +@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
>> +         if (ptc->description)
>> +             free(ptc->description);
>> +     }
>> +-    memset(tclist, 0, tc_alloc * sizeof(struct tc));
>> ++    SNMP_FREE(tclist);
>> ++    tc_alloc = 0;
>> +
>> +     memset(buckets, 0, sizeof(buckets));
>> +     memset(nbuckets, 0, sizeof(nbuckets));
>> +--
>> +2.34.1
>> +
>> 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 \
>>              file://reproducibility-have-printcap.patch \
>>              file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \
>>              file://CVE-2022-44792-CVE-2022-44793.patch \
>> +           file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \
>>              "
>>   SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"
>>
>>
>>
>>
> Hello,
> The 0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch file needs to be slightly adapted to be working.
> See my patch below:
>
> From 54ba004a7c12cddcbcb020878fb03bbf52db2855 Mon Sep 17 00:00:00 2001
> From: Piotr Lewicki <piotr.l.lewicki@hitachienergy.com>
> Date: Mon, 10 Mar 2025 10:18:27 +0100
> Subject: [meta-oe][kirkstone][PATCH] net-snmp: Adapt patch that fixes memory
>  leak
>
> In commit d0c2a3d383dac9fe7e85b7d87784b7f5b5c62c5e the patch that fixes
> a memory leak has been backported to kirkstone branch, but it was not
> adapted. This commit adapts the patch to apply properly on this branch.
>
> Signed-off-by: Piotr Lewicki <piotr.l.lewicki@hitachienergy.com>
> ---
>  ...all_mibs-fix-memory-leak-by-freeing-tclist.patch | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 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
> index cc498c7fc9..39f8ba1d61 100644
> --- 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
> @@ -13,19 +13,10 @@ Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
>  diff --git a/snmplib/parse.c b/snmplib/parse.c
> -index b3e2f3ae5c..71bdf75ff8 100644
> +index 9406f4f..2f9a201 100644
>  --- a/snmplib/parse.c
>  +++ b/snmplib/parse.c
> -@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
> - SOFTWARE.
> - ******************************************************************/
> - /*
> -- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
> -+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
> -  * Use is subject to license terms specified in the COPYING file
> -  * distributed with the Net-SNMP package.
> -  */
> -@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
> +@@ -4225,7 +4225,8 @@ unload_all_mibs(void)
>           if (ptc->description)
>               free(ptc->description);
>       }
> --
> 2.34.1
>
>
>
> Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
> ________________________________
> Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#115826): https://lists.openembedded.org/g/openembedded-devel/message/115826
> Mute This Topic: https://lists.openembedded.org/mt/111282761/6084445
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [skandigraun@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
  2025-03-10 10:56     ` Gyorgy Sarvari
@ 2025-03-11  6:46       ` Wang, Jinfeng (CN)
  2025-03-11  7:19         ` Piotr L Lewicki
  0 siblings, 1 reply; 10+ messages in thread
From: Wang, Jinfeng (CN) @ 2025-03-11  6:46 UTC (permalink / raw)
  To: Gyorgy Sarvari, piotr.l.lewicki,
	openembedded-devel@lists.openembedded.org, akuster808@gmail.com

Thanks for all your suggestions.


I tried to send my patch via "git send-mail", but every time after I 
saved my patch email, it failed to patch the *.eml in the git repo.

So could you please merge my pull request:

https://github.com/openembedded/meta-openembedded/pull/947


Thanks,

Jinfeng

On 3/10/2025 6:56 PM, Gyorgy Sarvari wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> That character change in the comment doesn't look material for the fix
> to take effect, it could be even left out of the backport completely.
>
> On 10.03.25 10:29, Piotr L Lewicki via lists.openembedded.org wrote:
>> From: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <Jinfeng.Wang.CN=windriver.com@lists.openembedded.org>
>> Sent: Monday, March 10, 2025 08:01
>> To: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org>; akuster808@gmail.com <akuster808@gmail.com>
>> Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
>>
>> [You don't often get email from jinfeng.wang.cn=windriver.com@lists.openembedded.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>>
>> Warning
>>
>> This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments.
>> If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
>> See the SecureWay group in Yammer for more security information.
>>
>> Sorry for interupt.
>>
>> Please revert my patch.
>>
>>
>> After I rebase the latest codes from kirkstone. I found my patch had a
>> bad character. This caused net-snmp do_patch failure.
>>
>> After some tries, I still failed to resolve this.
>>
>>
>> The cherry-pick in my side picked copyright change. But after sending
>> the patch via git send-mail, the character changed.
>>
>> Sorry again.
>>
>>
>> Thanks.
>>
>> Jinfeng
>>
>>
>> On 2/20/2025 10:27 AM, Wang, Jinfeng (CN) via lists.openembedded.org wrote:
>>> From: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>>>
>>> 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>
>>> ---
>>>    ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++
>>>    .../net-snmp/net-snmp_5.9.3.bb                |  1 +
>>>    2 files changed, 41 insertions(+)
>>>    create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch
>>>
>>> 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..3632881501
>>> --- /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,40 @@
>>> +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001
>>> +From: JanSoundhouse <jan.sondhauss@wago.com>
>>> +Date: Mon, 5 Sep 2022 11:25:58 +0200
>>> +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist
>>> +
>>> +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd.
>>> +
>>> +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62]
>>> +
>>> +Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>>> +---
>>> + snmplib/parse.c | 5 +++--
>>> + 1 file changed, 3 insertions(+), 2 deletions(-)
>>> +
>>> +diff --git a/snmplib/parse.c b/snmplib/parse.c
>>> +index b3e2f3ae5c..71bdf75ff8 100644
>>> +--- a/snmplib/parse.c
>>> ++++ b/snmplib/parse.c
>>> +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
>>> + SOFTWARE.
>>> + ******************************************************************/
>>> + /*
>>> +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
>>> ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
>>> +  * Use is subject to license terms specified in the COPYING file
>>> +  * distributed with the Net-SNMP package.
>>> +  */
>>> +@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
>>> +         if (ptc->description)
>>> +             free(ptc->description);
>>> +     }
>>> +-    memset(tclist, 0, tc_alloc * sizeof(struct tc));
>>> ++    SNMP_FREE(tclist);
>>> ++    tc_alloc = 0;
>>> +
>>> +     memset(buckets, 0, sizeof(buckets));
>>> +     memset(nbuckets, 0, sizeof(nbuckets));
>>> +--
>>> +2.34.1
>>> +
>>> 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 \
>>>               file://reproducibility-have-printcap.patch \
>>>               file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \
>>>               file://CVE-2022-44792-CVE-2022-44793.patch \
>>> +           file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \
>>>               "
>>>    SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"
>>>
>>>
>>>
>>>
>> Hello,
>> The 0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch file needs to be slightly adapted to be working.
>> See my patch below:
>>
>>  From 54ba004a7c12cddcbcb020878fb03bbf52db2855 Mon Sep 17 00:00:00 2001
>> From: Piotr Lewicki <piotr.l.lewicki@hitachienergy.com>
>> Date: Mon, 10 Mar 2025 10:18:27 +0100
>> Subject: [meta-oe][kirkstone][PATCH] net-snmp: Adapt patch that fixes memory
>>   leak
>>
>> In commit d0c2a3d383dac9fe7e85b7d87784b7f5b5c62c5e the patch that fixes
>> a memory leak has been backported to kirkstone branch, but it was not
>> adapted. This commit adapts the patch to apply properly on this branch.
>>
>> Signed-off-by: Piotr Lewicki <piotr.l.lewicki@hitachienergy.com>
>> ---
>>   ...all_mibs-fix-memory-leak-by-freeing-tclist.patch | 13 ++-----------
>>   1 file changed, 2 insertions(+), 11 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
>> index cc498c7fc9..39f8ba1d61 100644
>> --- 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
>> @@ -13,19 +13,10 @@ Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>>    1 file changed, 3 insertions(+), 2 deletions(-)
>>
>>   diff --git a/snmplib/parse.c b/snmplib/parse.c
>> -index b3e2f3ae5c..71bdf75ff8 100644
>> +index 9406f4f..2f9a201 100644
>>   --- a/snmplib/parse.c
>>   +++ b/snmplib/parse.c
>> -@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
>> - SOFTWARE.
>> - ******************************************************************/
>> - /*
>> -- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
>> -+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
>> -  * Use is subject to license terms specified in the COPYING file
>> -  * distributed with the Net-SNMP package.
>> -  */
>> -@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
>> +@@ -4225,7 +4225,8 @@ unload_all_mibs(void)
>>            if (ptc->description)
>>                free(ptc->description);
>>        }
>> --
>> 2.34.1
>>
>>
>>
>> Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
>> ________________________________
>> Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#115826): https://lists.openembedded.org/g/openembedded-devel/message/115826
>> Mute This Topic: https://lists.openembedded.org/mt/111282761/6084445
>> Group Owner: openembedded-devel+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [skandigraun@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
  2025-03-11  6:46       ` Wang, Jinfeng (CN)
@ 2025-03-11  7:19         ` Piotr L Lewicki
  2025-03-24 14:51             ` tim.dylla.ext
  0 siblings, 1 reply; 10+ messages in thread
From: Piotr L Lewicki @ 2025-03-11  7:19 UTC (permalink / raw)
  To: Gyorgy Sarvari, openembedded-devel@lists.openembedded.org,
	akuster808@gmail.com, Jinfeng.Wang.CN@windriver.com

From: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <Jinfeng.Wang.CN=windriver.com@lists.openembedded.org>
Sent: Tuesday, March 11, 2025 07:46
To: Gyorgy Sarvari <skandigraun@gmail.com>; Piotr L Lewicki <piotr.l.lewicki@hitachienergy.com>; openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org>; akuster808@gmail.com <akuster808@gmail.com>
Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak

[You don't often get email from jinfeng.wang.cn=windriver.com@lists.openembedded.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Warning

This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments.
If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
See the SecureWay group in Yammer for more security information.

Thanks for all your suggestions.


I tried to send my patch via "git send-mail", but every time after I
saved my patch email, it failed to patch the *.eml in the git repo.

So could you please merge my pull request:

https://github.com/openembedded/meta-openembedded/pull/947


Thanks,

Jinfeng

On 3/10/2025 6:56 PM, Gyorgy Sarvari wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> That character change in the comment doesn't look material for the fix
> to take effect, it could be even left out of the backport completely.
>
> On 10.03.25 10:29, Piotr L Lewicki via lists.openembedded.org wrote:
>> From: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <Jinfeng.Wang.CN=windriver.com@lists.openembedded.org>
>> Sent: Monday, March 10, 2025 08:01
>> To: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org>; akuster808@gmail.com <akuster808@gmail.com>
>> Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
>>
>> [You don't often get email from jinfeng.wang.cn=windriver.com@lists.openembedded.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>>
>> Warning
>>
>> This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments.
>> If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
>> See the SecureWay group in Yammer for more security information.
>>
>> Sorry for interupt.
>>
>> Please revert my patch.
>>
>>
>> After I rebase the latest codes from kirkstone. I found my patch had a
>> bad character. This caused net-snmp do_patch failure.
>>
>> After some tries, I still failed to resolve this.
>>
>>
>> The cherry-pick in my side picked copyright change. But after sending
>> the patch via git send-mail, the character changed.
>>
>> Sorry again.
>>
>>
>> Thanks.
>>
>> Jinfeng
>>
>>
>> On 2/20/2025 10:27 AM, Wang, Jinfeng (CN) via lists.openembedded.org wrote:
>>> From: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>>>
>>> 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>
>>> ---
>>>    ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++
>>>    .../net-snmp/net-snmp_5.9.3.bb                |  1 +
>>>    2 files changed, 41 insertions(+)
>>>    create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch
>>>
>>> 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..3632881501
>>> --- /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,40 @@
>>> +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001
>>> +From: JanSoundhouse <jan.sondhauss@wago.com>
>>> +Date: Mon, 5 Sep 2022 11:25:58 +0200
>>> +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist
>>> +
>>> +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd.
>>> +
>>> +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62]
>>> +
>>> +Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>>> +---
>>> + snmplib/parse.c | 5 +++--
>>> + 1 file changed, 3 insertions(+), 2 deletions(-)
>>> +
>>> +diff --git a/snmplib/parse.c b/snmplib/parse.c
>>> +index b3e2f3ae5c..71bdf75ff8 100644
>>> +--- a/snmplib/parse.c
>>> ++++ b/snmplib/parse.c
>>> +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
>>> + SOFTWARE.
>>> + ******************************************************************/
>>> + /*
>>> +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
>>> ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
>>> +  * Use is subject to license terms specified in the COPYING file
>>> +  * distributed with the Net-SNMP package.
>>> +  */
>>> +@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
>>> +         if (ptc->description)
>>> +             free(ptc->description);
>>> +     }
>>> +-    memset(tclist, 0, tc_alloc * sizeof(struct tc));
>>> ++    SNMP_FREE(tclist);
>>> ++    tc_alloc = 0;
>>> +
>>> +     memset(buckets, 0, sizeof(buckets));
>>> +     memset(nbuckets, 0, sizeof(nbuckets));
>>> +--
>>> +2.34.1
>>> +
>>> 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 \
>>>               file://reproducibility-have-printcap.patch \
>>>               file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \
>>>               file://CVE-2022-44792-CVE-2022-44793.patch \
>>> +           file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \
>>>               "
>>>    SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"
>>>
>>>
>>>
>>>
>> Hello,
>> The 0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch file needs to be slightly adapted to be working.
>> See my patch below:
>>
>>  From 54ba004a7c12cddcbcb020878fb03bbf52db2855 Mon Sep 17 00:00:00 2001
>> From: Piotr Lewicki <piotr.l.lewicki@hitachienergy.com>
>> Date: Mon, 10 Mar 2025 10:18:27 +0100
>> Subject: [meta-oe][kirkstone][PATCH] net-snmp: Adapt patch that fixes memory
>>   leak
>>
>> In commit d0c2a3d383dac9fe7e85b7d87784b7f5b5c62c5e the patch that fixes
>> a memory leak has been backported to kirkstone branch, but it was not
>> adapted. This commit adapts the patch to apply properly on this branch.
>>
>> Signed-off-by: Piotr Lewicki <piotr.l.lewicki@hitachienergy.com>
>> ---
>>   ...all_mibs-fix-memory-leak-by-freeing-tclist.patch | 13 ++-----------
>>   1 file changed, 2 insertions(+), 11 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
>> index cc498c7fc9..39f8ba1d61 100644
>> --- 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
>> @@ -13,19 +13,10 @@ Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>>    1 file changed, 3 insertions(+), 2 deletions(-)
>>
>>   diff --git a/snmplib/parse.c b/snmplib/parse.c
>> -index b3e2f3ae5c..71bdf75ff8 100644
>> +index 9406f4f..2f9a201 100644
>>   --- a/snmplib/parse.c
>>   +++ b/snmplib/parse.c
>> -@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
>> - SOFTWARE.
>> - ******************************************************************/
>> - /*
>> -- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
>> -+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
>> -  * Use is subject to license terms specified in the COPYING file
>> -  * distributed with the Net-SNMP package.
>> -  */
>> -@@ -4215,7 +4215,8 @@ unload_all_mibs(void)
>> +@@ -4225,7 +4225,8 @@ unload_all_mibs(void)
>>            if (ptc->description)
>>                free(ptc->description);
>>        }
>> --
>> 2.34.1
>>
>>
>>
>> Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
>> ________________________________
>> Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.
>>
>>
>>

The patch is not applying not only because of the special characters, but also due to wrong lines where the unload_all_mibs(void) is pointing to.
I suggest to:
1. Revert the "net-snmp: fix memory leak" patch, because all images that use net-snmp are not building at the moment (at least in my setup).
2. Fix the patch- all the info is in this email. Removing lines with special character is one thing, another is updating the line numbers in the second hunk so that it applies without any problems.

Best,
Piotr Lewicki
Common Linux Team
E-mail: piotr.l.lewicki@hitachienergy.com
http://www.hitachienergy.com/

---


Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
________________________________
Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
@ 2025-03-24 14:51             ` tim.dylla.ext
  0 siblings, 0 replies; 10+ messages in thread
From: tim.dylla.ext @ 2025-03-24 14:48 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 222 bytes --]

Confirmed (if that's of interest),

I second Piotr Lewicki in all aspects, the patch in its current form breaks building of net-snmp recipe.

...Patching patches, patching patches.... :)

All the best,

Tim Dylla

[-- Attachment #2: Type: text/html, Size: 380 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
@ 2025-03-24 14:51             ` tim.dylla.ext
  0 siblings, 0 replies; 10+ messages in thread
From: tim.dylla.ext @ 2025-03-24 14:51 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

Confirmed (if that's of interest),

I second Piotr Lewicki in all aspects, the patch in its current form breaks building of net-snmp recipe.

...Patching patches, patching patches.... :)

All the best,

Tim Dylla

> 
> The patch is not applying not only because of the special characters, but
> also due to wrong lines where the unload_all_mibs(void) is pointing to.
> I suggest to:
> 1. Revert the "net-snmp: fix memory leak" patch, because all images that
> use net-snmp are not building at the moment (at least in my setup).
> 2. Fix the patch- all the info is in this email. Removing lines with
> special character is one thing, another is updating the line numbers in
> the second hunk so that it applies without any problems.
> 
> Best,
> Piotr Lewicki
> Common Linux Team
> E-mail: piotr.l.lewicki@...
> http://www.hitachienergy.com/
>

[-- Attachment #2: Type: text/html, Size: 1156 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
       [not found]             ` <Groupsio.1.15989.1742827718915937909@lists.openembedded.org>
@ 2025-03-24 16:21               ` Piotr L Lewicki
  2025-04-09  3:17               ` Wang, Jinfeng (CN)
  1 sibling, 0 replies; 10+ messages in thread
From: Piotr L Lewicki @ 2025-03-24 16:21 UTC (permalink / raw)
  To: openembedded-devel@lists.openembedded.org,
	tim.dylla.ext@rohde-schwarz.com

Hi Tim,
If that's of any help - the net-snmp patch is already reverted in "kirkstone-next" branch.

It's unclear to me when/if this will also be ported to "kirkstone".

Best,
Piotr Lewicki


Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
________________________________
Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
       [not found]             ` <Groupsio.1.15989.1742827718915937909@lists.openembedded.org>
  2025-03-24 16:21               ` [oe] " Piotr L Lewicki
@ 2025-04-09  3:17               ` Wang, Jinfeng (CN)
  1 sibling, 0 replies; 10+ messages in thread
From: Wang, Jinfeng (CN) @ 2025-04-09  3:17 UTC (permalink / raw)
  To: tim.dylla.ext, openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 1858 bytes --]

I'm sorry for the incorrect patch.


I send v2.

In v2, I remove the special character and update the line number.


Best regards,

Jinfeng

On 3/24/2025 10:51 PM, tim.dylla.ext via lists.openembedded.org wrote:
> **
> *CAUTION: This email comes from a non Wind River email account!*
> Do not click links or open attachments unless you recognize the sender 
> and know the content is safe.
>
> [Edited Message Follows]
>
> Confirmed (if that's of interest),
>    I second Piotr Lewicki in all aspects, the patch in its current 
> form breaks building of net-snmp recipe.
>
> ...Patching patches, patching patches.... :)
>
> All the best,
>           Tim Dylla
>
>     The patch is not applying not only because of the special
>     characters, but also due to wrong lines where the
>     unload_all_mibs(void) is pointing to.
>     I suggest to:
>     1. Revert the "net-snmp: fix memory leak" patch, because all
>     images that use net-snmp are not building at the moment (at least
>     in my setup).
>     2. Fix the patch- all the info is in this email. Removing lines
>     with special character is one thing, another is updating the line
>     numbers in the second hunk so that it applies without any problems.
>
>     Best,
>     Piotr Lewicki
>     Common Linux Team
>     E-mail: piotr.l.lewicki@...
>     http://www.hitachienergy.com/
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#116210):https://lists.openembedded.org/g/openembedded-devel/message/116210
> Mute This Topic:https://lists.openembedded.org/mt/111282761/8617462
> Group Owner:openembedded-devel+owner@lists.openembedded.org
> Unsubscribe:https://lists.openembedded.org/g/openembedded-devel/unsub [Jinfeng.Wang.CN@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>

[-- Attachment #2: Type: text/html, Size: 3838 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-04-09  3:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1825C99274128577.23135@lists.openembedded.org>
2025-03-10  7:01 ` [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak Wang, Jinfeng (CN)
2025-03-10  9:29   ` Piotr L Lewicki
2025-03-10 10:56     ` Gyorgy Sarvari
2025-03-11  6:46       ` Wang, Jinfeng (CN)
2025-03-11  7:19         ` Piotr L Lewicki
2025-03-24 14:48           ` tim.dylla.ext
2025-03-24 14:51             ` tim.dylla.ext
     [not found]             ` <Groupsio.1.15989.1742827718915937909@lists.openembedded.org>
2025-03-24 16:21               ` [oe] " Piotr L Lewicki
2025-04-09  3:17               ` Wang, Jinfeng (CN)
2025-02-20  2:27 jinfeng.wang.cn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.