Blame SOURCES/autofs-5.1.8-fix-memory-leak-in-xdr_exports.patch

f3080c
autofs-5.1.8 - fix memory leak in xdr_exports()
f3080c
f3080c
From: Ian Kent <raven@themaw.net>
f3080c
f3080c
Converting xdr_exports() to not be recursive introduced a memory leak
f3080c
if an error is encountered, fix it.
f3080c
f3080c
Signed-off-by: Ian Kent <raven@themaw.net>
f3080c
---
f3080c
 CHANGELOG      |    1 +
f3080c
 lib/rpc_subs.c |    7 ++++++-
f3080c
 2 files changed, 7 insertions(+), 1 deletion(-)
f3080c
f3080c
--- autofs-5.1.4.orig/CHANGELOG
f3080c
+++ autofs-5.1.4/CHANGELOG
f3080c
@@ -89,6 +89,7 @@
f3080c
 - fix loop under run in cache_get_offset_parent().
f3080c
 - simplify cache_add() a little.
f3080c
 - fix use after free in tree_mapent_delete_offset_tree().
f3080c
+- fix memory leak in xdr_exports().
f3080c
 
f3080c
 xx/xx/2018 autofs-5.1.5
f3080c
 - fix flag file permission.
f3080c
--- autofs-5.1.4.orig/lib/rpc_subs.c
f3080c
+++ autofs-5.1.4/lib/rpc_subs.c
f3080c
@@ -1151,8 +1151,13 @@ bool_t xdr_exports(XDR *xdrs, struct exp
f3080c
 
f3080c
 	export = (char **) exports;
f3080c
 	while (1) {
f3080c
-		if (!xdr_pointer(xdrs, export, size, (xdrproc_t) xdr_export))
f3080c
+		if (!xdr_pointer(xdrs, export, size, (xdrproc_t) xdr_export)) {
f3080c
+			if (*exports) {
f3080c
+				rpc_exports_free(*exports);
f3080c
+				*exports = NULL;
f3080c
+			}
f3080c
 			return FALSE;
f3080c
+		}
f3080c
 		if (!*export)
f3080c
 			break;
f3080c
 		export = (char **) &((struct exportinfo *) *export)->next;