Project

General

Profile

Bug #4062

libscf: memory leaks in scf_simple_app_props_get()

Added by Marcel Telka about 7 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
2013-08-20
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

There are memory leaks in scf_simple_app_props_get().

In a case there are no property groups in both svc and inst (so the condition at line 2102 is true) the scf_simple_app_props_get() will leak ret, ret->ap_fmri, and ret->ap_pglist.

2102    if (ret->ap_pglist->pg_name == NULL)
2103        return (NULL);
2104
2105    return (ret);

In addition, if there is an error condition in the scf_simple_app_props_get() and the "goto error2" is executed, we will leak sys_fmri.

To reproduce the issue download attached leaks_share.c and leaks_share.sh and run leaks_share.sh.


Files

leaks_share.sh (409 Bytes) leaks_share.sh Marcel Telka, 2013-08-20 03:02 PM
leaks_share.c (1.17 KB) leaks_share.c Marcel Telka, 2013-08-20 03:02 PM

History

#1

Updated by Marcel Telka about 7 years ago

  • Status changed from In Progress to Pending RTI
#2

Updated by Marcel Telka about 7 years ago

  • Status changed from Pending RTI to Resolved
  • % Done changed from 0 to 100

Resolved in:

commit afffa6e9b45cbe9b33943e26568d8ac69b899252
Author: Marcel Telka <marcel.telka@nexenta.com>
Date:   Sun Aug 18 01:06:16 2013 +0200

    4062 libscf: memory leaks in scf_simple_app_props_get()
    Reviewed by: Jeffry Molanus <jeffry.molanus@nexenta.com>
    Reviewed by: Boris Protopopov <boris.protopopov@nexenta.com>
    Reviewed by: Andy Stormont <andyjstormont@gmail.com>
    Approved by: Dan McDonald <danmcd@nexenta.com>

Also available in: Atom PDF