[dm-devel] [PATCH v3] libmultipath: fix memory leaks in coalesce_paths
lixiaokeng
lixiaokeng at huawei.com
Mon Nov 9 04:16:35 UTC 2020
>>
>> + if (mpvec)
>> + newmp = mpvec;
>> + else
>> + newmp = vector_alloc();
>> + if (!newmp) {
>> + condlog(0, "can not allocate newmp");
>> + return ret;
>> + }
>> +
>
> It's possible that this patch is based on different code than I am
> looking at, but otherwise, You should either move this code below the
> code that checks the pathvec size and allocates the bitfield, or make
> the failure path for that code free newmp, if necessary. Otherwise, you
> could leak newmp on those failures.
>
> -Ben
>
>> /* ignore refwwid if it's empty */
>> if (refwwid && !strlen(refwwid))
>> refwwid = NULL;
Hi
Thanks for your great advice. I will move these codes after checking
the pathvec size and allocating the bitfield.
Regarts,
Lixiaokeng
More information about the dm-devel
mailing list