[PATCH 12/16] libmultipath: cleanup_free_ptr(): avoid double free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Martin Wilck <mwilck@xxxxxxxx>

... by nullifying the passed pointer after freeing it.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 libmpathutil/util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libmpathutil/util.c b/libmpathutil/util.c
index 1539738..6692ac2 100644
--- a/libmpathutil/util.c
+++ b/libmpathutil/util.c
@@ -391,8 +391,10 @@ void cleanup_free_ptr(void *arg)
 {
 	void **p = arg;
 
-	if (p && *p)
+	if (p && *p) {
 		free(*p);
+		*p = NULL;
+	}
 }
 
 void cleanup_fd_ptr(void *arg)
-- 
2.37.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux