spapr: Fix memory leak in h_client_architecture_support()
PATCH 1/1 spapr: Fix memory leak in h_client_architecture_support()
This is the only error path that needs to free the previously allocated ov1.
Reported-by Coverity (CID 1421924)
Fixes cbd0d7f36322 "spapr: Fail CAS if option vector table cannot be parsed"
Signed-off-by Greg Kurz <[email protected]>
--- hw/ppc/spapr_hcall.c | 1 + 1 file changed, 1 insertion(+)
hw/ppc/spapr_hcall.c +1 -0
@@ -1726,6 +1726,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu, } ov5_guest =spapr_ovec_parse_vector (ov_table,5 );if (!ov5_guest) { +spapr_ovec_cleanup (ov1_guest);warn_report ("guest didn't provide option vector 5" );return H_PARAMETER ; }
Quoted 15 lines · Greg Kurz
This is the only error path that needs to free the previously allocated ov1.
Reported-by Coverity (CID 1421924)Fixes cbd0d7f36322 "spapr: Fail CAS if option vector table cannot be parsed"Signed-off-by Greg Kurz <[email protected]>--- hw/ppc/spapr_hcall.c | 1 + 1 file changed, 1 insertion(+)hw/ppc/spapr_hcall.c +0
-0
hw/ppc/spapr_hcall.c static target_ulong h_client_architecture_support(PowerPCCPU *cpu, · line 1729
Quoted 4 lines
hw/ppc/spapr_hcall.c +1
-0@@ -1726,6 +1726,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu, } ov5_guest =spapr_ovec_parse_vector (ov_table,5 );if (!ov5_guest) { +spapr_ovec_cleanup (ov1_guest);
Quicker than using g_autoptr(), so for 5.0:
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 4 lines
hw/ppc/spapr_hcall.c +0
-0warn_report ("guest didn't provide option vector 5" );return H_PARAMETER ; }
David Gibson
AppliedQuoted 6 lines · Greg Kurz
This is the only error path that needs to free the previously allocated ov1.
Reported-by Coverity (CID 1421924)Fixes cbd0d7f36322 "spapr: Fail CAS if option vector table cannot be parsed"Signed-off-by Greg Kurz <[email protected]>
Applied to ppc-forr-5.0.
Quoted 17 lines
--- hw/ppc/spapr_hcall.c | 1 + 1 file changed, 1 insertion(+)hw/ppc/spapr_hcall.c +1
-0@@ -1726,6 +1726,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu, } ov5_guest =spapr_ovec_parse_vector (ov_table,5 );if (!ov5_guest) { +spapr_ovec_cleanup (ov1_guest);warn_report ("guest didn't provide option vector 5" );return H_PARAMETER ; }
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson