summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2004-03-12 21:02:59 +0000
committerBob Beck <beck@cvs.openbsd.org>2004-03-12 21:02:59 +0000
commitb96b558c5f6f8af38a103c054f61da96f5643717 (patch)
treeda5fcda4184a4fa33fdb37741ed1ecdb1d951054
parentccf1b33d90919ccde1a23cb9c14e3f79e393e35a (diff)
paranoia and cleanup, ensure we use free then NULL everywhere.
ok millert@ dhartmei@
-rw-r--r--libexec/spamd/spamd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c
index 714172972c2..62223c2d69b 100644
--- a/libexec/spamd/spamd.c
+++ b/libexec/spamd/spamd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd.c,v 1.58 2004/03/11 18:32:17 beck Exp $ */
+/* $OpenBSD: spamd.c,v 1.59 2004/03/12 21:02:58 beck Exp $ */
/*
* Copyright (c) 2002 Theo de Raadt. All rights reserved.
@@ -533,8 +533,11 @@ initcon(struct con *cp, int fd, struct sockaddr_in *sin)
time(&t);
free(cp->obuf);
cp->obuf = NULL;
- if (cp->blacklists)
- free(cp->blacklists);
+ cp->osize = 0;
+ free(cp->blacklists);
+ cp->blacklists = NULL;
+ free(cp->lists);
+ cp->lists = NULL;
bzero(cp, sizeof(struct con));
if (grow_obuf(cp, 0) == NULL)
err(1, "malloc");
@@ -586,7 +589,7 @@ closecon(struct con *cp)
free(cp->blacklists);
cp->blacklists = NULL;
}
- if (cp->osize > 0) {
+ if (cp->obuf != NULL) {
free(cp->obuf);
cp->obuf = NULL;
cp->osize = 0;