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

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