xl: properly dispose of vTPM struct instance
PATCH 1/1 xl: properly dispose of vTPM struct instance
The backend_domname field requires separate freeing; make sure to call libxl_device_vtpm_dispose() also on respective error paths.
Coverity-ID: 1638719
Fixes dde22055ac3a ("libxl: add vtpm support")
Signed-off-by Jan Beulich <[email protected]>
tools/xl/xl_vtpm.c +3 -0
@@ -44,12 +44,14 @@ int main_vtpmattach(int argc, char **argif (MATCH_OPTION ("uuid" , *argv, oparg)) {if (libxl_uuid_from_string (&(vtpm.uuid), oparg)) {fprintf (stderr,"Invalid uuid specified (%s)\n" , oparg); +libxl_device_vtpm_dispose (&vtpm);return 1 ; } }else if (MATCH_OPTION ("backend" , *argv, oparg)) {replace_string (&vtpm.backend_domname, oparg); }else {fprintf (stderr,"unrecognized argument `%s'\n" , *argv); +libxl_device_vtpm_dispose (&vtpm);return 1 ; } }
@@ -65,6 +67,7 @@ int main_vtpmattach(int argc, char **argif (libxl_device_vtpm_add (ctx, domid, &vtpm,0 )) {fprintf (stderr,"libxl_device_vtpm_add failed.\n" ); +libxl_device_vtpm_dispose (&vtpm);return 1 ; }libxl_device_vtpm_dispose (&vtpm);
Quoted 6 lines · Jan Beulich
The
backend_domnamefield requires separate freeing; make sure to calllibxl_device_vtpm_dispose()also on respective error paths.Coverity-ID: 1638719
Fixes dde22055ac3a ("libxl: add vtpm support")Signed-off-by Jan Beulich <[email protected]>
Reviewed-by Andrew Cooper <[email protected]>
Quoted 6 lines · Jan Beulich
The
backend_domnamefield requires separate freeing; make sure to calllibxl_device_vtpm_dispose()also on respective error paths.Coverity-ID: 1638719
Fixes dde22055ac3a ("libxl: add vtpm support")Signed-off-by Jan Beulich <[email protected]>
R-Acked-By Oleksii Kurochko <[email protected]>
Thanks.
~ Oleksii
Quoted 26 lines
tools/xl/xl_vtpm.c +3
-0@@ -44,12 +44,14 @@ int main_vtpmattach(int argc, char **argif (MATCH_OPTION ("uuid" , *argv, oparg)) {if (libxl_uuid_from_string (&(vtpm.uuid), oparg)) {fprintf (stderr,"Invalid uuid specified (%s)\n" , oparg); +libxl_device_vtpm_dispose (&vtpm);return 1 ; } }else if (MATCH_OPTION ("backend" , *argv, oparg)) {replace_string (&vtpm.backend_domname, oparg); }else {fprintf (stderr,"unrecognized argument `%s'\n" , *argv); +libxl_device_vtpm_dispose (&vtpm);return 1 ; } }@@ -65,6 +67,7 @@ int main_vtpmattach(int argc, char **argif (libxl_device_vtpm_add (ctx, domid, &vtpm,0 )) {fprintf (stderr,"libxl_device_vtpm_add failed.\n" ); +libxl_device_vtpm_dispose (&vtpm);return 1 ; }libxl_device_vtpm_dispose (&vtpm);
Quoted 6 lines · Jan Beulich
The
backend_domnamefield requires separate freeing; make sure to calllibxl_device_vtpm_dispose()also on respective error paths.Coverity-ID: 1638719
Fixes dde22055ac3a ("libxl: add vtpm support")Signed-off-by Jan Beulich <[email protected]>
Acked-by Anthony PERARD <[email protected]>
Thanks,
Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech