Hi Matthias,

This bug report was submitted against the Debian Leafnode package.
I attached a patch against latest git that would fix the mentioned
problem.

Please CC 568128-forwar...@bugs.debian.org on replies.

Thanks,
Robert
----- Forwarded message from Helmut Grohne <hel...@subdivi.de> -----

From: Helmut Grohne <hel...@subdivi.de>
Date: Tue, 2 Feb 2010 17:35:54 +0100
To: Debian Bug Tracking System <sub...@bugs.debian.org>
Subject: Bug#568128: leafnode: filedescriptor leak in fetchnews.c in 
getbody_newno

Package: src:leafnode
Version: 1.11.7.rel-2
Severity: normal
Tags: patch

In fetchnews.c in function getbody_newno it looks like f is closed in
all circumstances. However this is not the case. This function can
therefore leak filedescriptors.

When it fails to fopen g it leaves f open, but exits the function via a
goto getbody_tail. This is a rare case, but can be easily fixed by
inserting the missing fclose.

Helmut




----- End forwarded message -----

>From d50886af33ba08226c052d8bdb8ddb2143d2d3cc Mon Sep 17 00:00:00 2001
From: Robert Grimm <r...@robgri.de>
Date: Wed, 3 Feb 2010 08:40:11 +0100
Subject: [PATCH] Fix file descriptor leak in getbody_newno()

Signed-off-by: Robert Grimm <r...@robgri.de>
---
 fetchnews.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fetchnews.c b/fetchnews.c
index 8b16d66..871fd9d 100644
--- a/fetchnews.c
+++ b/fetchnews.c
@@ -457,6 +457,7 @@ getbody_newno(const struct server *current_server, struct 
newsgroup *group, unsi
     g = fopen(s, "r");
     if (!g) {
        ln_log(LNLOG_SERR, LNLOG_CARTICLE, "%s: open %s failed", group->name, 
s);
+       fclose(f);
        rc = 0;
        goto getbody_bail;
     }
-- 
1.5.6.5




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to