[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #56806] Mem Leak in http_post_request
From: |
Stian Sebastian Skjelstad |
Subject: |
[lwip-devel] [bug #56806] Mem Leak in http_post_request |
Date: |
Mon, 26 Aug 2019 04:23:37 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 |
Follow-up Comment #1, bug #56806 (project lwip):
http_post_rxpbuf sends the pbuf to http_post_get_response_uri
/**
* @ingroup httpd
* Called for each pbuf of data that has been received for a POST.
* ATTENTION: The application is responsible for freeing the pbufs passed in!
*
* @param connection Unique connection identifier.
* @param p Received data.
* @return ERR_OK: Data accepted.
* another err_t: Data denied, http_post_get_response_uri will be
called.
*/
err_t httpd_post_receive_data(void *connection, struct pbuf *p);
So, your callback is responsible for doing a pbuf_unref.
Your fix is a workaround for your callback not doing its job, in one of the
code-paths. Take a look at the top two lines in your patch too:
pbuf_ref(q); // <------ this would be a problem too if your
httpd_post_receive_data doesn't do the pbuf_unref it is suppose to do
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;
_______________________________________________________
Reply to this item at:
<https://savannah.nongnu.org/bugs/?56806>
_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/