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

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