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

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