2018-08-01 18:09 GMT+02:00 Marcos Paulo de Souza <marcos.souza....@gmail.com>:
> This is a new version from the last patchset sent yesterday, but now using
> VIR_STRNDUP, instead of allocating memory manually.
>
> First version: 
> https://www.redhat.com/archives/libvir-list/2018-August/msg00000.html
>
> Marcos Paulo de Souza (2):
>   esx: Do not crash SetAutoStart by double free
>   esx: Fix SetAutoStart invalid pointer free
>
>  src/esx/esx_driver.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)

I see the problem, but your approach is too complicated.

There is already code in place to handle those situations:

3417  cleanup:
3418     if (newPowerInfo) {
3419         newPowerInfo->key = NULL;
3420         newPowerInfo->startAction = NULL;
3421         newPowerInfo->stopAction = NULL;
3422     }

That resets those fields to NULL to avoid double freeing and freeing
static strings.

The problem is that commit ae83e02f3dd7fe99fed5d8159a35b666fafeafd5 by
John Frelan broke this logic, by setting newPowerInfo to NULL in the
success path, to silence Coverity.

-- 
Matthias Bolte
http://photron.blogspot.com

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to