diff options
author | Ian Kent <raven@themaw.net> | 2022-01-27 10:40:52 +0800 |
---|---|---|
committer | Ian Kent <raven@themaw.net> | 2022-05-06 09:14:36 +0800 |
commit | 658273c4778fb23f7525f1ff0d5e0224ea5affe3 (patch) | |
tree | 1a9ba3e267adbd7a361623067a06f7e923bd88d1 | |
parent | e7be5f4a98896fb17344b3a2f2f538c191110233 (diff) | |
download | autofs-658273c4778fb23f7525f1ff0d5e0224ea5affe3.tar.gz |
autofs-5.1.8 - fix memory leak in xdr_exports()
Converting xdr_exports() to not be recursive introduced a memory leak
if an error is encountered, fix it.
Signed-off-by: Ian Kent <raven@themaw.net>
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | lib/rpc_subs.c | 7 |
2 files changed, 7 insertions, 1 deletions
@@ -11,6 +11,7 @@ - fix nfsv4 only mounts should not use rpcbind. - simplify cache_add() a little. - fix use after free in tree_mapent_delete_offset_tree(). +- fix memory leak in xdr_exports(). 19/10/2021 autofs-5.1.8 - add xdr_exports(). diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c index ee7f94b9..0c833af0 100644 --- a/lib/rpc_subs.c +++ b/lib/rpc_subs.c @@ -1151,8 +1151,13 @@ bool_t xdr_exports(XDR *xdrs, struct exportinfo **exports) export = (char **) exports; while (1) { - if (!xdr_pointer(xdrs, export, size, (xdrproc_t) xdr_export)) + if (!xdr_pointer(xdrs, export, size, (xdrproc_t) xdr_export)) { + if (*exports) { + rpc_exports_free(*exports); + *exports = NULL; + } return FALSE; + } if (!*export) break; export = (char **) &((struct exportinfo *) *export)->next; |