lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #56806] Mem Leak in http_post_request


From: Klaus Sperlich
Subject: [lwip-devel] [bug #56806] Mem Leak in http_post_request
Date: Mon, 26 Aug 2019 04:04:01 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0

URL:
  <https://savannah.nongnu.org/bugs/?56806>

                 Summary: Mem Leak in http_post_request
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: schraubenkarl
            Submitted on: Mon 26 Aug 2019 08:03:59 AM UTC
                Category: apps
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.1.1

    _______________________________________________________

Details:

After about 16 http POST requests pbuf_alloc returned NULL.

I figured out that in function http_post_request at line 1845

            pbuf_ref(q);
              return http_post_rxpbuf(hs, q);
            } else if (hs->post_content_len_left == 0) {
              q = pbuf_alloc(PBUF_RAW, 0, PBUF_REF);
              return http_post_rxpbuf(hs, q);
            } else {
              return ERR_OK;

the  memory allocated by   
   
    q = pbuf_alloc(PBUF_RAW, 0, PBUF_REF);

is never been deallocated. 

After changing the code to:

    pbuf_ref(q);
              return http_post_rxpbuf(hs, q);
            } else if (hs->post_content_len_left == 0) {
              q = pbuf_alloc(PBUF_RAW, 0, PBUF_REF);
              err_t err;
              err = http_post_rxpbuf(hs, q);
              pbuf_free (q);
              return err;
            } else {
              return ERR_OK;

no memory leak is seen further.

Can somebody confirm the issue and also the solution?
thx 




    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56806>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]