From: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
To: dm-devel@redhat.com, bmarzins@redhat.com, christophe.varoqui@opensvc.com
Subject: [PATCH v2 1/2] libmultipath: prevent memory leak in alloc_path_with_pathinfo() if pp_ptr is NULL
Date: Tue, 13 Dec 2016 16:27:08 -0200 [thread overview]
Message-ID: <1481653629-22430-1-git-send-email-mauricfo@linux.vnet.ibm.com> (raw)
In alloc_path_with_pathinfo(), if the 'pp_ptr' argument is NULL
(which is acceptable and checked in the function in two places)
the 'pp' pointer is lost as it is not referenced anywhere else;
thus the memory allocated for it is leaked.
So, call free_path() in the case 'pp_ptr' is NULL too.
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
libmultipath/discovery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 7b5b4344b2a1..3c5c808436b2 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -58,7 +58,7 @@ alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice,
err = pathinfo(pp, conf, flag | DI_BLACKLIST);
}
- if (err)
+ if (err || !pp_ptr)
free_path(pp);
else if (pp_ptr)
*pp_ptr = pp;
--
1.8.3.1
next reply other threads:[~2016-12-13 18:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-13 18:27 Mauricio Faria de Oliveira [this message]
2016-12-13 18:27 ` [PATCH v2 2/2] multipathd: skip spurious event message for blacklisted paths Mauricio Faria de Oliveira
2016-12-13 21:50 ` Benjamin Marzinski
2016-12-13 23:53 ` Mauricio Faria de Oliveira
2016-12-14 12:53 ` Martin Wilck
2016-12-20 17:00 ` Benjamin Marzinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1481653629-22430-1-git-send-email-mauricfo@linux.vnet.ibm.com \
--to=mauricfo@linux.vnet.ibm.com \
--cc=bmarzins@redhat.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox