2301. [bug] Remove resource leak and fix error messages in

bin/tests/system/lwresd/lwtest.c. [RT #17474]
This commit is contained in:
Mark Andrews
2008-01-14 12:02:11 +00:00
parent 80f20cb452
commit 034f775ae1
2 changed files with 12 additions and 6 deletions

View File

@@ -1,3 +1,6 @@
2301. [bug] Remove resource leak and fix error messages in
bin/tests/system/lwresd/lwtest.c. [RT #17474]
2300. [bug] Fixed failure to close open file in
bin/tests/names/t_names.c. [RT #17473]

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwtest.c,v 1.29 2007/09/13 04:45:18 each Exp $ */
/* $Id: lwtest.c,v 1.30 2008/01/14 12:02:11 marka Exp $ */
#include <config.h>
@@ -350,6 +350,7 @@ test_getipnodebyname(const char *name, const char *address, int af,
if (hp->h_addrtype != af) {
printf("I:getipnodebyname(%s) returned wrong family\n",
name);
freehostent(hp);
fails++;
return;
}
@@ -361,6 +362,7 @@ test_getipnodebyname(const char *name, const char *address, int af,
outbuf, sizeof(outbuf));
printf("I:getipnodebyname(%s) returned %s, "
"expected %s\n", name, outbuf, address);
freehostent(hp);
fails++;
return;
}
@@ -427,20 +429,21 @@ test_getipnodebyaddr(const char *address, int af, const char *name) {
if (name == NULL && error_num == HOST_NOT_FOUND)
return;
else if (error_num != HOST_NOT_FOUND) {
printf("I:gethostbyaddr(%s) failed: %d\n",
printf("I:getipnodebyaddr(%s) failed: %d\n",
address, error_num);
fails++;
return;
} else {
printf("I:gethostbyaddr(%s) returned not found\n",
printf("I:getipnodebyaddr(%s) returned not found\n",
address);
fails++;
return;
}
} else {
if (strcmp(hp->h_name, name) != 0) {
printf("I:gethostbyname(%s) returned %s, "
printf("I:getipnodebyaddr(%s) returned %s, "
"expected %s\n", address, hp->h_name, name);
freehostent(hp);
fails++;
return;
}
@@ -588,12 +591,12 @@ test_getnameinfo(const char *address, int af, const char *name) {
}
} else {
if (name == NULL) {
printf("I:getaddrinfo(%s) returned %s, "
printf("I:getnameinfo(%s) returned %s, "
"expected NULL\n", address, host);
fails++;
return;
} else if (strcmp(host, name) != 0) {
printf("I:getaddrinfo(%s) returned %s, expected %s\n",
printf("I:getnameinfo(%s) returned %s, expected %s\n",
address, host, name);
fails++;
return;