diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-03-03 14:47:38 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-03-03 14:47:38 +0000 |
commit | 786918dfa4fc8dde44f26da9bccc51bcd769890b (patch) | |
tree | a350074cfe318c24473b8e0be8c46cea8d782467 /libexec | |
parent | 0a7b803bc121b15cc8fbc8e1cd862934b4b2b605 (diff) |
always set ptr to NULL after free; from cloder
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/spamd/sdl.c | 5 | ||||
-rw-r--r-- | libexec/spamd/spamd.c | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/libexec/spamd/sdl.c b/libexec/spamd/sdl.c index 293a9c76465..757342ef2cc 100644 --- a/libexec/spamd/sdl.c +++ b/libexec/spamd/sdl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdl.c,v 1.3 2003/03/02 20:40:15 deraadt Exp $ */ +/* $OpenBSD: sdl.c,v 1.4 2003/03/03 14:47:37 deraadt Exp $ */ /* * Copyright (c) 2003 Bob Beck. All rights reserved. * @@ -69,8 +69,11 @@ sdl_add(char *sdname, char *sdstring, char ** addrs, int addrc) if (debug > 0) printf("replacing list %s\n", blacklists[index].tag); free(blacklists[index].tag); + blacklists[index].tag = NULL; free(blacklists[index].string); + blacklists[index].string = NULL; free(blacklists[index].addrs); + blacklists[index].addrs = NULL; } else { if (debug > 0) printf("adding list %s\n", sdname); 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) |