mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 03:59:52 +00:00
ppc: fix memory leak in spapr_dt_drc()
Leaking the drc_name while preparing the DT properties. Fixing that. Also, remove the const qualifier from spapr_drc_name(). Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Message-Id: <156335159028.82682.5404622104535818162.stgit@lep8c.aus.stglabs.ibm.com> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
d758880586
commit
dbd26f2f7f
@ -227,7 +227,7 @@ static uint32_t drc_set_unusable(SpaprDrc *drc)
|
||||
return RTAS_OUT_SUCCESS;
|
||||
}
|
||||
|
||||
static const char *spapr_drc_name(SpaprDrc *drc)
|
||||
static char *spapr_drc_name(SpaprDrc *drc)
|
||||
{
|
||||
SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
|
||||
|
||||
@ -828,6 +828,7 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask)
|
||||
Object *obj;
|
||||
SpaprDrc *drc;
|
||||
SpaprDrcClass *drck;
|
||||
char *drc_name = NULL;
|
||||
uint32_t drc_index, drc_power_domain;
|
||||
|
||||
if (!strstart(prop->type, "link<", NULL)) {
|
||||
@ -857,8 +858,10 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask)
|
||||
g_array_append_val(drc_power_domains, drc_power_domain);
|
||||
|
||||
/* ibm,drc-names */
|
||||
drc_names = g_string_append(drc_names, spapr_drc_name(drc));
|
||||
drc_name = spapr_drc_name(drc);
|
||||
drc_names = g_string_append(drc_names, drc_name);
|
||||
drc_names = g_string_insert_len(drc_names, -1, "\0", 1);
|
||||
g_free(drc_name);
|
||||
|
||||
/* ibm,drc-types */
|
||||
drc_types = g_string_append(drc_types, drck->typename);
|
||||
|
Loading…
Reference in New Issue
Block a user