diff mbox series

[16/19] Removed a resource leak from mount/stropts.c

Message ID 20190508133536.6077-17-steved@redhat.com (mailing list archive)
State New, archived
Headers show
Series Covertity Scan: Removed resources leaks | expand

Commit Message

Steve Dickson May 8, 2019, 1:35 p.m. UTC
mount/stropts.c:986: leaked_storage: Variable "address"
	going out of scope leaks the storage it points to.

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/mount/stropts.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index a093926..1bb7a73 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -983,8 +983,11 @@  static int nfs_try_mount(struct nfsmount_info *mi)
 		}
 
 		if (!nfs_append_addr_option(address->ai_addr,
-					    address->ai_addrlen, mi->options))
+					    address->ai_addrlen, mi->options)) {
+			nfs_freeaddrinfo(address);
+			errno = ENOMEM;
 			return 0;
+		}
 		mi->address = address;
 	}