[PATCH] secur32: Fix memory leak in SECUR32_addPackages. (valgrind)
Lei Zhang
thestig at google.com
Thu Dec 17 03:54:20 CST 2009
On Wed, Dec 16, 2009 at 5:13 PM, James Hawkins <truiken at gmail.com> wrote:
> On Wed, Dec 16, 2009 at 5:07 PM, Lei Zhang <thestig at google.com> wrote:
>> Hi, this is for bug 21045.
>>
>
> + SecurePackage *prev_package = NULL;
> LIST_FOR_EACH_ENTRY(package, &packageTable->table,
> SecurePackage, entry)
> {
> + if (prev_package)
> + HeapFree(GetProcessHeap(), 0, prev_package);
> + prev_package = package;
> HeapFree(GetProcessHeap(), 0, package->infoW.Name);
> HeapFree(GetProcessHeap(), 0, package->infoW.Comment);
> }
> + if (prev_package)
> + HeapFree(GetProcessHeap(), 0, prev_package);
>
>
> I believe the construct you're looking for is LIST_FOR_EACH_SAFE.
> grep through the code for examples on using that to safely free and
> remove elements from a list.
LIST_FOR_EACH_ENTRY_SAFE, actually. Thanks.
More information about the wine-devel
mailing list