Blame SOURCES/nfs-utils-1.3.0-mountd-memleak.patch

64c563
diff -up nfs-utils-1.3.0/support/export/xtab.c.orig nfs-utils-1.3.0/support/export/xtab.c
64c563
--- nfs-utils-1.3.0/support/export/xtab.c.orig	2014-03-25 11:12:07.000000000 -0400
64c563
+++ nfs-utils-1.3.0/support/export/xtab.c	2019-05-23 10:38:39.361594392 -0400
64c563
@@ -43,6 +43,14 @@ xtab_read(char *xtab, char *lockfn, int
64c563
 	while ((xp = getexportent(is_export==0, 0)) != NULL) {
64c563
 		if (!(exp = export_lookup(xp->e_hostname, xp->e_path, is_export != 1)) &&
64c563
 		    !(exp = export_create(xp, is_export!=1))) {
64c563
+                        if(xp->e_hostname) {
64c563
+                            free(xp->e_hostname);
64c563
+                            xp->e_hostname=NULL;
64c563
+                        }
64c563
+                        if(xp->e_uuid) {
64c563
+                            free(xp->e_uuid);
64c563
+                            xp->e_uuid=NULL;
64c563
+                        }
64c563
 			continue;
64c563
 		}
64c563
 		switch (is_export) {
64c563
@@ -58,7 +66,16 @@ xtab_read(char *xtab, char *lockfn, int
64c563
 		case 2:
64c563
 			exp->m_exported = -1;/* may be exported */
64c563
 			break;
64c563
-		}
64c563
+		}  
64c563
+                if(xp->e_hostname) {
64c563
+                    free(xp->e_hostname);
64c563
+                    xp->e_hostname=NULL;
64c563
+                }
64c563
+                if(xp->e_uuid) {
64c563
+                    free(xp->e_uuid);
64c563
+                    xp->e_uuid=NULL;
64c563
+                }
64c563
+
64c563
 	}
64c563
 	endexportent();
64c563
 	xfunlock(lockid);
64c563
diff -up nfs-utils-1.3.0/support/nfs/exports.c.orig nfs-utils-1.3.0/support/nfs/exports.c
64c563
--- nfs-utils-1.3.0/support/nfs/exports.c.orig	2019-05-23 10:38:07.558133270 -0400
64c563
+++ nfs-utils-1.3.0/support/nfs/exports.c	2019-05-23 10:38:39.362594376 -0400
64c563
@@ -179,9 +179,20 @@ getexportent(int fromkernel, int fromexp
64c563
 	xfree(ee.e_hostname);
64c563
 	ee.e_hostname = xstrdup(hostname);
64c563
 
64c563
-	if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0)
64c563
-		return NULL;
64c563
+	if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0) {
64c563
+                if(ee.e_hostname)
64c563
+                {
64c563
+                    xfree(ee.e_hostname);
64c563
+                    ee.e_hostname=NULL;
64c563
+                }
64c563
+                if(ee.e_uuid)
64c563
+                {
64c563
+                    xfree(ee.e_uuid);
64c563
+                    ee.e_uuid=NULL;
64c563
+                }
64c563
 
64c563
+		return NULL;
64c563
+        }
64c563
 	/* resolve symlinks */
64c563
 	if (realpath(ee.e_path, rpath) != NULL) {
64c563
 		rpath[sizeof (rpath) - 1] = '\0';