aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-11 08:27:40 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-11 08:27:40 -0700
commit24f54b976eb5835f24c03c792bceaaa723cef948 (patch)
tree6c7ed21706fcece066094aeb7575b1b34a2a4ecf /src
parentd612eafe174e57bad9061af3ddf0a145fe359591 (diff)
downloadnng-24f54b976eb5835f24c03c792bceaaa723cef948.tar.gz
nng-24f54b976eb5835f24c03c792bceaaa723cef948.tar.bz2
nng-24f54b976eb5835f24c03c792bceaaa723cef948.zip
Leaking poll fds.
We never set the fd->sn_init member, causing new fds to be allocated on each request for a new pollfd, and causing old ones to leak, and worse may be even to not get notified. While here, we arrange for a bit richer testing against the various options.
Diffstat (limited to 'src')
-rw-r--r--src/core/options.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/options.c b/src/core/options.c
index 6d4afdb4..170e7407 100644
--- a/src/core/options.c
+++ b/src/core/options.c
@@ -1,5 +1,6 @@
//
-// Copyright 2016 Garrett D'Amore <garrett@damore.org>
+// Copyright 2017 Garrett D'Amore <garrett@damore.org>
+// Copyright 2017 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
@@ -191,7 +192,8 @@ nni_getopt_fd(nni_sock *s, nni_notifyfd *fd, int mask, void *val, size_t *szp)
return (NNG_ENOMEM);
}
- *szp = sizeof(int);
+ fd->sn_init = 1;
+ *szp = sizeof(int);
memcpy(val, &fd->sn_rfd, sizeof(int));
return (0);
}