summaryrefslogtreecommitdiff
path: root/libexec/spamd/spamd.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-03 14:47:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-03 14:47:38 +0000
commit786918dfa4fc8dde44f26da9bccc51bcd769890b (patch)
treea350074cfe318c24473b8e0be8c46cea8d782467 /libexec/spamd/spamd.c
parent0a7b803bc121b15cc8fbc8e1cd862934b4b2b605 (diff)
always set ptr to NULL after free; from cloder
Diffstat (limited to 'libexec/spamd/spamd.c')
-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 7d1ab09e8e6..e7b100da54c 100644
--- a/libexec/spamd/spamd.c
+++ b/libexec/spamd/spamd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd.c,v 1.18 2003/03/03 00:51:40 cloder Exp $ */
+/* $OpenBSD: spamd.c,v 1.19 2003/03/03 14:47:37 deraadt Exp $ */
/*
* Copyright (c) 2002 Theo de Raadt. All rights reserved.
@@ -223,6 +223,7 @@ parse_configs(void)
if (debug > 0)
perror("malloc()");
free(cb);
+ cb = NULL;
cbs = cbu = 0;
return;
}
@@ -262,6 +263,7 @@ do_config(void)
if (debug > 0)
perror("malloc()");
free(cb);
+ cb = NULL;
cbs = 0;
goto configdone;
}
@@ -378,8 +380,8 @@ no_mem:
/* Out of memory, free obuf and bail, caller must deal */
if (cp->osize)
free(cp->obuf);
- cp->osize = 0;
cp->obuf = NULL;
+ cp->osize = 0;
return (-1);
}
@@ -394,8 +396,8 @@ build_reply(struct con *cp)
if (matches == NULL) {
if (cp->osize)
free(cp->obuf);
- cp->osize = 0;
cp->obuf = NULL;
+ cp->osize = 0;
goto bad;
}
for (; *matches; matches++) {
@@ -414,8 +416,8 @@ build_reply(struct con *cp)
if (c == NULL) {
if (cp->osize)
free(cp->obuf);
- cp->osize = 0;
cp->obuf = NULL;
+ cp->osize = 0;
goto bad;
}
}
@@ -479,6 +481,7 @@ initcon(struct con *cp, int fd, struct sockaddr_in *sin)
time(&t);
if (cp->obufalloc) {
free(cp->obuf);
+ cp->obuf = NULL;
}
bzero(cp, sizeof(struct con));
if (grow_obuf(cp, 0) == NULL)