From: Zhiqiang Liu Subject: Re: [dm- devel][PATCH V2] Date: Wed, 29 Jul 2020 09:54:27 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: bmarzins@redhat.com, mwilck@suse.com, hare@suse.de, christophe.varoqui@opensvc.com, kabelac@redhat.com Cc: linfeilong , yanxiaodan@huawei.com, dm-devel@redhat.com, lixiaokeng List-Id: dm-devel.ids Sorry for forgetting to add a subject. I will resend the v2 patch. On 2020/7/29 9:52, Zhiqiang Liu wrote: > > In disassemble_status func, for dealing with selector args, > word is allocated by get_word func. However, word is not freed. > Then a memory leak occurs. > > Here, we call FREE(word) to free word. > > Fixes: 35ad40b4 ('leastpending IO loadbalancing is not displayed properly') > Signed-off-by: Zhiqiang Liu > Signed-off-by: lixiaokeng > Reviewed-by: Benjamin Marzinski > --- > libmultipath/dmparser.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c > index 3dc77242..33f47405 100644 > --- a/libmultipath/dmparser.c > +++ b/libmultipath/dmparser.c > @@ -580,10 +580,15 @@ int disassemble_status(char *params, struct multipath *mpp) > if (!strncmp(mpp->selector, > "least-pending", 13)) { > p += get_word(p, &word); > + > + if (!word) > + return 1; > + > if (sscanf(word,"%d:*d", > &def_minio) == 1 && > def_minio != mpp->minio) > mpp->minio = def_minio; > + FREE(word); > } else > p += get_word(p, NULL); > } >