diff mbox series

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

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

Commit Message

Alice Mitchell Aug. 6, 2021, 12:33 p.m. UTC
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",