buglwIP - A Lightweight TCP/IP stack - Bugs: bug #48330, Memory leak in snmp_send_trap...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #48330: Memory leak in snmp_send_trap function

Submitted by:  Marco Veeneman <mave>
Submitted on:  Tue 28 Jun 2016 02:18:44 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Tue 28 Jun 2016 07:32:10 PM UTC, comment #3:

Correct! Thanks for reporting!

Dirk Ziegelmeier <dziegel>
Project Member
Tue 28 Jun 2016 05:38:42 PM UTC, comment #2:

Yes that should work

Marco Veeneman <mave>
Tue 28 Jun 2016 04:51:00 PM UTC, comment #1:

AFAIU, you are right. Do you mean like this: (patch attached) ?

diff --git a/src/apps/snmp/snmp_traps.c b/src/apps/snmp/snmp_traps.c
index 3da2dca..1ca7d28 100644
--- a/src/apps/snmp/snmp_traps.c
+++ b/src/apps/snmp/snmp_traps.c
@@ -192,6 +192,7 @@ snmp_send_trap(const struct snmp_obj_id *device_enterprise_o

/** send to the TRAP destination */
snmp_sendto(snmp_traps_handle, p, &td->dip, SNMP_TRAP_PORT);
+ pbuf_free(p);
} else {
err = ERR_MEM;
}

(file #37613)

Sergio R. Caprile <scaprile>
Tue 28 Jun 2016 02:18:44 PM UTC, original submission:

Sending traps causes leaking memory.
In snmp_send_trap a pbuf is allocated in RAM but it is never freed. Probably this was introduced while rewriting the SNMP traps.

I think adding pbuf_free(p); after snmp_sendto solves this issue.

Marco Veeneman <mave>

 

Attached Files
file #37613:  snmpatch.txt added by scaprile (458B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dziegel (Posted a comment)
  • -unavailable- added by goldsimon (Updated the item)
  • -unavailable- added by mave (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 28 Jun 2016 07:32:10 PM UTCdziegelStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Tue 28 Jun 2016 06:50:29 PM UTCgoldsimonPlanned Release=>2.0.0 Beta2
    Tue 28 Jun 2016 04:51:00 PM UTCscaprileAttached File-=>Added snmpatch.txt, #37613

    Back to the top


    Powered by Savane 3.1-cleanup1