[PATCH 2/4] s3-libads: Fix memory leaks in ads_build_path().

Andreas Schneider asn at samba.org
Thu Jan 9 07:23:41 MST 2014


Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/libads/ads_struct.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index fd7e417..30d433e 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/libads/ads_struct.c
@@ -55,12 +55,14 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int
 	if (strlcpy(ret,field, len) >= len) {
 		/* Truncate ! */
 		free(r);
+		free(ret);
 		return NULL;
 	}
 	p=strtok_r(r, sep, &saveptr);
 	if (p) {
 		if (strlcat(ret, p, len) >= len) {
 			free(r);
+			free(ret);
 			return NULL;
 		}
 
-- 
1.8.5.2




More information about the samba-technical mailing list