git://scientific.zcu.cz
/
jra1mw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5091e6b
)
handle hostent properly
author
Daniel Kouřil
<kouril@ics.muni.cz>
Thu, 8 Dec 2011 10:51:47 +0000
(10:51 +0000)
committer
Daniel Kouřil
<kouril@ics.muni.cz>
Thu, 8 Dec 2011 10:51:47 +0000
(10:51 +0000)
emi.canl.canl-c/src/canl.c
patch
|
blob
|
blame
|
history
diff --git
a/emi.canl.canl-c/src/canl.c
b/emi.canl.canl-c/src/canl.c
index
c3e069b
..
145fbf5
100644
(file)
--- a/
emi.canl.canl-c/src/canl.c
+++ b/
emi.canl.canl-c/src/canl.c
@@
-136,6
+136,9
@@
int canl_io_connect(canl_ctx cc, canl_io_handler io, char * host, int port,
return set_error(cc, EINVAL, posix_error, "IO handler not initialized");
/*dns TODO - wrap it for using ipv6 and ipv4 at the same time*/
+ ar.ent = (struct hostent *) calloc (1, sizeof(struct hostent));
+ if (ar.ent == NULL)
+ return set_error(cc, ENOMEM, posix_error, "Not enough memory");
switch (err = asyn_getservbyname(AF_INET, &ar, host, NULL)) {
case NETDB_SUCCESS:
@@
-202,6
+205,9
@@
int canl_io_connect(canl_ctx cc, canl_io_handler io, char * host, int port,
err = 0;
end:
+ if (ar.ent != NULL)
+ free_hostent(ar.ent);
+
return err;
}