[PATCH v2 2/5] winegstreamer: Move the conditional cleanup to the create error path.

Rémi Bernon rbernon at codeweavers.com
Tue Feb 22 03:04:11 CST 2022


On 2/22/22 09:58, Chip Davis wrote:
> February 22, 2022 2:37 AM, "Rémi Bernon" <rbernon at codeweavers.com> wrote:
> 
>> diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c
>> index e4545774428..81badd0be67 100644
>> --- a/dlls/winegstreamer/wg_transform.c
>> +++ b/dlls/winegstreamer/wg_transform.c
>> @@ -77,15 +75,13 @@ NTSTATUS wg_transform_create(void *args)
>>       struct wg_format output_format = *params->output_format;
>>       struct wg_format input_format = *params->input_format;
>>       GstCaps *src_caps = NULL, *sink_caps = NULL;
>> +    NTSTATUS status = STATUS_UNSUCCESSFUL;
>>       GstPadTemplate *template = NULL;
>>       struct wg_transform *transform;
>> -    NTSTATUS status;
>>
>>       if (!init_gstreamer())
>>           return STATUS_UNSUCCESSFUL;
>>
>> -    status = STATUS_NO_MEMORY;
>> -
>>       if (!(transform = calloc(1, sizeof(*transform))))
>>           goto done;
> 
> Wait, won't this...
> 
>>
>> @@ -124,8 +120,11 @@ done:
>>       if (status)
>>       {
>>           GST_ERROR("Failed to create winegstreamer transform.");
>> -        if (transform)
>> -            wg_transform_destroy(transform);
>> +        if (transform->my_sink)
>> +            g_object_unref(transform->my_sink);
>> +        if (transform->my_src)
>> +            g_object_unref(transform->my_src);
> 
> ...result in a null dereference here?
> 
>> +        free(transform);
>>       }
>>       else
>>       {
>> -- 
>> 2.34.1
> 
> 
> Chip
> 

Eh, indeed... thanks.
-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list