4 ms·
It was definitely malloc'd memory, as I remember removing free() calls from the callee and adding them to the caller.
by smarks 4y ago
It was definitely malloc'd memory, as I remember removing free() calls from the callee and adding them to the caller.
- dragontamer 4y agoThat's the old "source/sink" pattern. "Source" functions return a malloc'd pointer. You have to manually call free on it, or pass it to a "sink" function (which internally calls free). In C, this is seen in strdup. C++ took this pattern and formalized it into auto_ptr<>, and later unique_ptr<> when RValue references became a thing in C++11.