[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Sun Apr 25 22:03:01 UTC 2021
The branch, master has been updated
via 16d1abb63eb lib:replace: Fix possible resource leaks in test_closefrom()
via a9ad677eb85 lib:replace: Fix memory leak in test_asprintf()
via 68cb9a0e6c7 lib:replace: Fix a memleak in test_strndup()
via dca03ffa8ab lib:replace: Fix a memleak in test_strdup()
via 2e973ea5f13 lib:replace: Fix resource leak in os2_delete test
from 17294c6bb77 lib:ldb: Change page size of guidindexpackv1.ldb
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 16d1abb63ebc6a5566238c1077b5623b18e87643
Author: Andreas Schneider <asn at samba.org>
Date: Thu Apr 22 15:25:57 2021 +0200
lib:replace: Fix possible resource leaks in test_closefrom()
Found by covscan
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sun Apr 25 22:02:20 UTC 2021 on sn-devel-184
commit a9ad677eb8527849ac686180c489d7dcb7f76e80
Author: Andreas Schneider <asn at samba.org>
Date: Thu Apr 22 15:20:27 2021 +0200
lib:replace: Fix memory leak in test_asprintf()
Found by covscan
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 68cb9a0e6c7991280154387527cd919e92d05c20
Author: Andreas Schneider <asn at samba.org>
Date: Thu Apr 22 15:05:07 2021 +0200
lib:replace: Fix a memleak in test_strndup()
Found by covscan
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit dca03ffa8ab682a2705da8cb25cab899338a1375
Author: Andreas Schneider <asn at samba.org>
Date: Thu Apr 22 15:03:25 2021 +0200
lib:replace: Fix a memleak in test_strdup()
Found by covscan
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2e973ea5f1392e7644b5d0706a34a7cae7bb7141
Author: Andreas Schneider <asn at samba.org>
Date: Thu Apr 22 15:01:39 2021 +0200
lib:replace: Fix resource leak in os2_delete test
Found by covscan
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/replace/tests/os2_delete.c | 1 +
lib/replace/tests/testsuite.c | 37 +++++++++++++++++++++++++++++--------
2 files changed, 30 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/replace/tests/os2_delete.c b/lib/replace/tests/os2_delete.c
index 4b99ccf9103..df8a8f59ec2 100644
--- a/lib/replace/tests/os2_delete.c
+++ b/lib/replace/tests/os2_delete.c
@@ -106,6 +106,7 @@ int test_readdir_os2_delete(void)
d = opendir(TESTDIR "/test0.txt");
if (d != NULL) FAILED("opendir() on file succeed");
if (errno != ENOTDIR) FAILED("opendir() on file didn't give ENOTDIR");
+ closedir(d);
d = opendir(TESTDIR);
diff --git a/lib/replace/tests/testsuite.c b/lib/replace/tests/testsuite.c
index 2ece95332d2..d8afa15480b 100644
--- a/lib/replace/tests/testsuite.c
+++ b/lib/replace/tests/testsuite.c
@@ -164,11 +164,16 @@ static int test_memmove(void)
static int test_strdup(void)
{
char *x;
+ int cmp;
+
printf("test: strdup\n");
x = strdup("bla");
- if (strcmp("bla", x) != 0) {
+
+ cmp = strcmp("bla", x);
+ if (cmp != 0) {
printf("failure: strdup [\nfailed: expected \"bla\", got \"%s\"\n]\n",
x);
+ free(x);
return false;
}
free(x);
@@ -259,26 +264,34 @@ static int test_setenv(void)
static int test_strndup(void)
{
char *x;
+ int cmp;
+
printf("test: strndup\n");
x = strndup("bla", 0);
- if (strcmp(x, "") != 0) {
+ cmp = strcmp(x, "");
+ free(x);
+ if (cmp != 0) {
printf("failure: strndup [\ninvalid\n]\n");
return false;
}
- free(x);
+
x = strndup("bla", 2);
- if (strcmp(x, "bl") != 0) {
+ cmp = strcmp(x, "bl");
+ free(x);
+ if (cmp != 0) {
printf("failure: strndup [\ninvalid\n]\n");
return false;
}
- free(x);
+
x = strndup("bla", 10);
- if (strcmp(x, "bla") != 0) {
+ cmp = strcmp(x, "bla");
+ free(x);
+ if (cmp != 0) {
printf("failure: strndup [\ninvalid\n]\n");
free(x);
return false;
}
- free(x);
+
printf("success: strndup\n");
return true;
}
@@ -325,24 +338,30 @@ static int test_setegid(void)
static int test_asprintf(void)
{
- char *x;
+ char *x = NULL;
+
printf("test: asprintf\n");
if (asprintf(&x, "%d", 9) != 1) {
printf("failure: asprintf [\ngenerate asprintf\n]\n");
+ free(x);
return false;
}
if (strcmp(x, "9") != 0) {
printf("failure: asprintf [\ngenerate asprintf\n]\n");
+ free(x);
return false;
}
if (asprintf(&x, "dat%s", "a") != 4) {
printf("failure: asprintf [\ngenerate asprintf\n]\n");
+ free(x);
return false;
}
if (strcmp(x, "data") != 0) {
printf("failure: asprintf [\ngenerate asprintf\n]\n");
+ free(x);
return false;
}
+ free(x);
printf("success: asprintf\n");
return true;
}
@@ -1070,6 +1089,7 @@ static bool test_closefrom(void)
fd = dup(0);
if (fd == -1) {
perror("dup failed");
+ closefrom(3);
return false;
}
@@ -1077,6 +1097,7 @@ static bool test_closefrom(void)
if (fd >= 1000) {
printf("fd=%d\n", fd);
+ closefrom(3);
return false;
}
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list