From 24f54b976eb5835f24c03c792bceaaa723cef948 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 11 Aug 2017 08:27:40 -0700 Subject: 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. --- src/core/options.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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 +// Copyright 2017 Garrett D'Amore +// Copyright 2017 Capitar IT Group BV // // 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); } -- cgit v1.2.3-70-g09d2