buglwIP - A Lightweight TCP/IP stack - Bugs: bug #59033, Possible memory leak in...

 
 

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

bug #59033: Possible memory leak in mqtt_disconnect

Submitted by:  Ondrej Lufinka <ondrej_lufinka>
Submitted on:  Fri 28 Aug 2020 01:12:59 PM UTC  
 
Category:  Platform ports Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Wed 13 Jan 2021 09:26:43 PM UTC, comment #2: 

It seems this bug should be closed.

Erik Ekman <yarrick>
Project Member
Fri 18 Sep 2020 10:12:44 AM UTC, comment #1: 

Hi Ondrej,

The altcp_mbedtls_close() already calls altcp_close(conn->inner_conn) which as put the socket in closing state.

The raw TCP connection under the mbedTLS connection must follow the TCP state machine, and should not destroyed like this.

Wait a few minutes, and you'll see the TCP socket is released correctly.

Regards,
David

David GIRAULT <dgirault>
Fri 28 Aug 2020 01:12:59 PM UTC, original submission:  

I use LwIP on STM32 MCU. I have a working combination of LwIP + MbedTLS + MQTT. I found a possible memory leak in function mqtt_disconnect. The PCB:

client->conn->inner_conn->state

used for connection is never released.

When I added the line

tcp_abandon((struct tcp_pcb *)client->conn->inner_conn->state, 0);

to the mqtt_disconnect function, the memory leak is gone.

Ondrej Lufinka <ondrej_lufinka>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by yarrick (Posted a comment)
  • -email is unavailable- added by dgirault (Posted a comment)
  • -email is unavailable- added by ondrej_lufinka (Submitted the item)
  •  

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

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-01-13 yarrick StatusNone => Works For Me
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.5