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

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