[PATCH] regress: fix memleak in snprintftest

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



Release buffer acquired in test.
---
 openbsd-compat/regress/snprintftest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/openbsd-compat/regress/snprintftest.c b/openbsd-compat/regress/snprintftest.c
index 4ca63e18..224ba7c5 100644
--- a/openbsd-compat/regress/snprintftest.c
+++ b/openbsd-compat/regress/snprintftest.c
@@ -47,7 +47,7 @@ int
 main(void)
 {
 	char b[5];
-	char *src;
+	char *src = NULL;
 
 	snprintf(b,5,"123456789");
 	if (b[4] != '\0')
@@ -69,5 +69,7 @@ main(void)
 	if (x_snprintf(b, 1, "%s %d", "hello", 12345) != 11)
 		fail("vsnprintf does not return required length");
 
+	if(src)
+		free(src);
 	return failed;
 }
-- 
2.22.0

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux