arduino-libraries / ArduinoMDNS

mDNS Library for Arduino
40 stars 13 forks source link

Fix invalid call to free() in 'addServiceRecord' #23

Open jf-0 opened 1 year ago

jf-0 commented 1 year ago

If some memory allocation in the member function addServiceRecord fails it will call 'goto errorReturn;'. At errorReturn there is a call to my_free which ALWAYS frees 'record->servName' at the moment.

This PR sets servName to 0, which will later prevent the call to free (if it is called too early)

Live-Screenshot of the bug: image assert failed: heap_caps_free heap_caps.c:360 (heap != NULL && "free() target pointer is outside heap areas"