Thread (6 messages) 6 messages, 2 authors, 2021-08-26
STALE1756d
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH 4/4 v2] nfs-utils: Fix mem leak in mountd

From: Alice Mitchell <hidden>
Date: 2021-08-12 18:13:34
Subsystem: the rest · Maintainer: Linus Torvalds

leak of mountlist struct and content on error

Signed-off-by: Alice Mitchell <redacted>
---
 utils/mountd/rmtab.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c
index 2da9761..752fdb6 100644
--- a/utils/mountd/rmtab.c
+++ b/utils/mountd/rmtab.c
@@ -233,6 +233,9 @@ mountlist_list(void)
 			m->ml_directory = strdup(rep->r_path);
 
 			if (m->ml_hostname == NULL || m->ml_directory == NULL) {
+				free(m->ml_hostname);
+				free(m->ml_directory);
+				free(m);
 				mountlist_freeall(mlist);
 				mlist = NULL;
 				xlog(L_ERROR, "%s: memory allocation failed",
-- 
2.27.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help