Re: [libvirt] [PATCH] esx: Fix potential memory leak in esxVI_BuildFullTraversalSpecItem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/3/22 Daniel P. Berrange <berrange@xxxxxxxxxx>:
> On Mon, Mar 22, 2010 at 01:55:45AM +0100, Matthias Bolte wrote:
>> If esxVI_String_DeepCopyValue or esxVI_SelectionSpec_AppendToList fail
>> then selectionSpec would leak. Add a free call in the failure path to
>> fix the leak.
>> ---
>>  src/esx/esx_vi.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
>> index aa46532..63ddaa4 100644
>> --- a/src/esx/esx_vi.c
>> +++ b/src/esx/esx_vi.c
>> @@ -1163,8 +1163,6 @@ esxVI_BuildFullTraversalSpecItem(esxVI_SelectionSpec **fullTraversalSpecList,
>>          currentSelectSetName = selectSetNames;
>>
>>          while (currentSelectSetName != NULL && *currentSelectSetName != '\0') {
>> -            selectionSpec = NULL;
>> -
>>              if (esxVI_SelectionSpec_Alloc(&selectionSpec) < 0 ||
>>                  esxVI_String_DeepCopyValue(&selectionSpec->name,
>>                                             currentSelectSetName) < 0 ||
>> @@ -1173,6 +1171,7 @@ esxVI_BuildFullTraversalSpecItem(esxVI_SelectionSpec **fullTraversalSpecList,
>>                  goto failure;
>>              }
>>
>> +            selectionSpec = NULL;
>>              currentSelectSetName += strlen(currentSelectSetName) + 1;
>>          }
>>      }
>> @@ -1186,6 +1185,7 @@ esxVI_BuildFullTraversalSpecItem(esxVI_SelectionSpec **fullTraversalSpecList,
>>
>>    failure:
>>      esxVI_TraversalSpec_Free(&traversalSpec);
>> +    esxVI_SelectionSpec_Free(&selectionSpec);
>>
>>      return -1;
>>  }
>
> ACK
>
>
> Daniel
>

Thanks, pushed.

Matthias

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]