summaryrefslogtreecommitdiff
path: root/ext/socket/udpsocket.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-09 23:52:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-09 23:52:23 +0000
commit38e6235235a556dfa28175b541a3cd42b480a319 (patch)
treeca07b6c466c401bc9559d9b6810d115c34f8c4cb /ext/socket/udpsocket.c
parent24e5e374107bfa02bd9dda971067cb34473e265e (diff)
udpsocket.c: memory leaks
* ext/socket/udpsocket.c (udp_connect, udp_bind, udp_send): fix memory leaks at closed socket. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/udpsocket.c')
-rw-r--r--ext/socket/udpsocket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c
index 85b4e6a..bbd588a 100644
--- a/ext/socket/udpsocket.c
+++ b/ext/socket/udpsocket.c
@@ -84,8 +84,8 @@ udp_connect(VALUE sock, VALUE host, VALUE port)
struct udp_arg arg;
VALUE ret;
- arg.res = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
GetOpenFile(sock, fptr);
+ arg.res = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
arg.fd = fptr->fd;
ret = rb_ensure(udp_connect_internal, (VALUE)&arg,
rsock_freeaddrinfo, (VALUE)arg.res);
@@ -112,8 +112,8 @@ udp_bind(VALUE sock, VALUE host, VALUE port)
struct rb_addrinfo *res0;
struct addrinfo *res;
- res0 = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
GetOpenFile(sock, fptr);
+ res0 = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
for (res = res0->ai; res; res = res->ai_next) {
if (bind(fptr->fd, res->ai_addr, res->ai_addrlen) < 0) {
continue;
@@ -166,8 +166,8 @@ udp_send(int argc, VALUE *argv, VALUE sock)
rb_scan_args(argc, argv, "4", &arg.mesg, &flags, &host, &port);
StringValue(arg.mesg);
- res0 = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
GetOpenFile(sock, fptr);
+ res0 = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
arg.fd = fptr->fd;
arg.flags = NUM2INT(flags);
for (res = res0->ai; res; res = res->ai_next) {