Project

General

Profile

Bug #6956

libproc cannot leave free() to callers

Added by Robert Mustacchi almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Category:
lib - userland libraries
Start date:
2016-05-05
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

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.

#1

Updated by Electric Monk almost 5 years ago

  • Status changed from New to Closed

git commit 43051d2742bbe5911de73322064cb573b6aff975

commit  43051d2742bbe5911de73322064cb573b6aff975
Author: Robert Mustacchi <rm@joyent.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 <ryan@zinascii.com>
    Reviewed by: Cody Mello <cody.mello@joyent.com>
    Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Also available in: Atom PDF