aboutsummaryrefslogtreecommitdiff
path: root/network
diff options
context:
space:
mode:
authorAndrew Strong <andrew.david.45@gmail.com>2010-12-26 12:02:19 -0600
committerNiels Horn <niels.horn@slackbuilds.org>2010-12-27 20:06:57 -0200
commitef09447e36f282203a14900c2c303d7a343ba726 (patch)
tree62e20d192199092f0decc660b0e4436560ac3df1 /network
parent215bf2d1f7aed56bfa205c864cec738ef371d899 (diff)
network/leafnode: Fix memory leak with applyfilter
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'network')
-rw-r--r--network/leafnode/applyfilter_plugleak.diff37
-rw-r--r--network/leafnode/leafnode.SlackBuild7
2 files changed, 41 insertions, 3 deletions
diff --git a/network/leafnode/applyfilter_plugleak.diff b/network/leafnode/applyfilter_plugleak.diff
new file mode 100644
index 000000000000..54274cb99803
--- /dev/null
+++ b/network/leafnode/applyfilter_plugleak.diff
@@ -0,0 +1,37 @@
+--- a/applyfilter.c
++++ b/applyfilter.c
+@@ -71,14 +71,12 @@ static int applyfilter(const char *name, struct newsgroup *g,
+ unsigned long *kept, unsigned long *deleted)
+ {
+ static size_t lsize = MAXHEADERSIZE + 1;
+- static char *l;
++ char *l;
+ struct stat st;
+ int score, fd;
+ struct utimbuf u;
+ unsigned long n;
+
+- l = (char *)critmalloc(lsize, "Space for article");
+-
+ if (stat(name, &st)) {
+ ln_log(LNLOG_SNOTICE, LNLOG_CARTICLE,
+ "cannot stat file \"%s\" in newsgroup %s: %m",
+@@ -97,6 +95,8 @@ static int applyfilter(const char *name, struct newsgroup *g,
+ return 0;
+ }
+
++ l = (char *)critmalloc(lsize, "Space for article");
++
+ if((fd = open(name, O_RDONLY)) >= 0)
+ {
+ int ret;
+@@ -167,6 +167,9 @@ static int applyfilter(const char *name, struct newsgroup *g,
+ ln_log(LNLOG_SERR, LNLOG_CARTICLE,
+ "could not open file \"%s\" in newsgroup %s\n",
+ name, g->name);
++
++ free(l);
++
+ return 0;
+ }
+
diff --git a/network/leafnode/leafnode.SlackBuild b/network/leafnode/leafnode.SlackBuild
index 720e91c334db..d485cba99eab 100644
--- a/network/leafnode/leafnode.SlackBuild
+++ b/network/leafnode/leafnode.SlackBuild
@@ -24,15 +24,13 @@
PRGNAM=leafnode
VERSION=2.0.0.alpha20081229a
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
-# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
- # Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
@@ -71,7 +69,10 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+# Fix compiler error with recent gcc:
patch -p1 < $CWD/sizeof_fix.diff
+# Fix memory leak with applyfilter:
+patch -p1 < $CWD/applyfilter_plugleak.diff
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \