[PATCH 2/2] msi: Don't leak memory on failure.

Pierre Schweitzer pierre at reactos.org
Sun Oct 22 04:15:46 CDT 2017


Hi Nikolay,

Thanks for your review. I'm not really keen on mixing success and
failure path that way for quick understanding of the code.
Shall I really rewrite the patch the way you asked or was it just a
proposal?

Cheers,
Pierre

Le 21/10/2017 à 12:16, Nikolay Sivov a écrit :
> On 21.10.2017 12:50, Pierre Schweitzer wrote:
>>          row = MSI_CreateRecord(1);
>>          if (!row)
>> +        {
>> +            msi_free(buffer);
>>              return NULL;
>> +        }
>>          MSI_RecordSetStringW(row, 1, buffer);
>>          msi_free(buffer);
>>          return row;
> 
> You can replace this with:
> 
> ---
> row = MSI_CreateRecord(1);
> if (row)
>     MSI_RecordSetStringW(row, 1, buffer);
> msi_free(buffer);
> return row;
> ---
> 
> 


-- 
Pierre Schweitzer <pierre at reactos.org>
System & Network Administrator
Senior Kernel Developer
ReactOS Deutschland e.V.



More information about the wine-devel mailing list