Credit goes to "cppcheck" Signed-off-by: Thomas Jarosch <thomas.jarosch at intra2net.com> --- common/common.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/common/common.c b/common/common.c index f443cb7..e8004d7 100644 --- a/common/common.c +++ b/common/common.c @@ -244,6 +244,7 @@ int sendsignalfn(const char *pidfn, int sig) if (fgets(buf, sizeof(buf), pidf) == NULL) { upslogx(LOG_NOTICE, "Failed to read pid from %s", pidfn); + fclose(pidf); return -1; } @@ -251,6 +252,7 @@ int sendsignalfn(const char *pidfn, int sig) if (pid < 2) { upslogx(LOG_NOTICE, "Ignoring invalid pid number %d", pid); + fclose(pidf); return -1; } @@ -259,6 +261,7 @@ int sendsignalfn(const char *pidfn, int sig) if (ret < 0) { perror("kill"); + fclose(pidf); return -1; } @@ -267,9 +270,11 @@ int sendsignalfn(const char *pidfn, int sig) if (ret < 0) { perror("kill"); + fclose(pidf); return -1; } + fclose(pidf); return 0; } -- 1.7.4.4
EmilienKia at Eaton.com
2011-Aug-31 12:50 UTC
[Nut-upsdev] [PATCH 1/3] Fix file descriptor leak
Hi Thomas> -----Message d'origine----- > De : > nut-upsdev-bounces+emilienkia=eaton.com at lists.alioth.debian.or > g > [mailto:nut-upsdev-bounces+emilienkia=eaton.com at lists.alioth.d > ebian.org] De la part de Thomas Jarosch > Envoy? : dimanche 28 ao?t 2011 01:02 > ? : nut-upsdev at lists.alioth.debian.org > Objet : [Nut-upsdev] [PATCH 1/3] Fix file descriptor leak > > Credit goes to "cppcheck" > > Signed-off-by: Thomas Jarosch <thomas.jarosch at intra2net.com> > --- > common/common.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/common/common.c b/common/common.c index > f443cb7..e8004d7 100644 > --- a/common/common.c > +++ b/common/common.c > @@ -244,6 +244,7 @@ int sendsignalfn(const char *pidfn, int sig) > > if (fgets(buf, sizeof(buf), pidf) == NULL) { > upslogx(LOG_NOTICE, "Failed to read pid from > %s", pidfn); > + fclose(pidf); > return -1; > } > > @@ -251,6 +252,7 @@ int sendsignalfn(const char *pidfn, int sig) > > if (pid < 2) { > upslogx(LOG_NOTICE, "Ignoring invalid pid > number %d", pid); > + fclose(pidf); > return -1; > } > > @@ -259,6 +261,7 @@ int sendsignalfn(const char *pidfn, int sig) > > if (ret < 0) { > perror("kill"); > + fclose(pidf); > return -1; > } > > @@ -267,9 +270,11 @@ int sendsignalfn(const char *pidfn, int sig) > > if (ret < 0) { > perror("kill"); > + fclose(pidf); > return -1; > } > > + fclose(pidf); > return 0; > } > > -- > 1.7.4.4 > >Thanks for your patch. I have just applied it to the trunk (r3171). QA checks are always welcome. Best regards Emilien KIA Opensource Team Engineering Software & Connectivity Eaton's Electrical Group PQCO/DPQD emilienkia at eaton.com www.eaton.com --------------------------------------------------------------------------
Reasonably Related Threads
- How to read or write Geolocation (RFC6442) data in SIP/PJSIP messages ?
- SIP/2.0 489 Bad Event in reply to a PUBLISH
- asterisk hints can be in multiple states; most sip NOTIFY dialogs only send one state
- Attempting to get BLF working with linphone
- [nut-commits] svn commit r2809 - branches/ssl-nss-port/server