diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-08-11 08:27:40 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-08-11 08:27:40 -0700 |
| commit | 24f54b976eb5835f24c03c792bceaaa723cef948 (patch) | |
| tree | 6c7ed21706fcece066094aeb7575b1b34a2a4ecf /src/core/options.c | |
| parent | d612eafe174e57bad9061af3ddf0a145fe359591 (diff) | |
| download | nng-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/core/options.c')
| -rw-r--r-- | src/core/options.c | 6 |
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); } |
