libproc cannot leave free() to callers
libproc allocates memory on behalf of callers in a couple functions. However, it currently expects them to call free(). This is an anti-pattern. Importantly, due to the way that binding and interposing work, the malloc and free that libproc is using could be very different from the caller. For example, libproc could end up calling malloc using libc's malloc and the caller may be using libumem. The solution here is simple, for any routine where we're allocating memory for the caller (about two or three), we need a corresponding free.
Updated by Electric Monk almost 5 years ago
- Status changed from New to Closed
commit 43051d2742bbe5911de73322064cb573b6aff975 Author: Robert Mustacchi <email@example.com> Date: 2016-05-12T16:47:18.000Z 6955 libproc should be documented and shipped 6956 libproc cannot leave free() to callers Reviewed by: Ryan Zezeski <firstname.lastname@example.org> Reviewed by: Cody Mello <email@example.com> Reviewed by: Joshua M. Clulow <firstname.lastname@example.org> Approved by: Richard Lowe <email@example.com>