esp-request icon indicating copy to clipboard operation
esp-request copied to clipboard

Fixing memory leak in req_setopt

Open vtunr opened this issue 6 years ago • 3 comments

A memory leak could happen if req was null or there was no data when call req_setopt, because it was returning after the malloc.

Moving the malloc after the check solves the issue.

vtunr avatar May 23 '18 09:05 vtunr

Thank @vtunr This project is no longer supported, please refer to

https://github.com/espressif/esp-idf/tree/master/components/esp_http_client

tuanpmt avatar May 24 '18 01:05 tuanpmt

Thanks, i didn't know it was on esp-idf yet.

I'll switch to it.

Tony

vtunr avatar May 24 '18 08:05 vtunr

esp_http_client is too heavy for simple tasks and has memory issues as well by the way...

@tuanpmt Tuan, thanks for sharing anyway.

@vtunr Tony, your fix seems working. I will leave code running for an hour to see if it is stable... i have http tasks coming every 5 seconds... will ping u with results.

skitsanos avatar Jan 22 '19 19:01 skitsanos