diff mbox series

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

Message ID 20210812181319.3885781-5-ajmitchell@redhat.com (mailing list archive)
State New, archived
Headers show
Series nfs-utils: A series of memory fixes | expand

Commit Message

Alice Mitchell Aug. 12, 2021, 6:13 p.m. UTC
leak of mountlist struct and content on error

Signed-off-by: Alice Mitchell <ajmitchell@redhat.com>
---
 utils/mountd/rmtab.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

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",