Project

General

Profile

Actions

Bug #4062

closed

libscf: memory leaks in scf_simple_app_props_get()

Added by Marcel Telka about 9 years ago. Updated about 9 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:
External Bug:

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
Actions

Also available in: Atom PDF