diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-30 18:47:01 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-30 18:47:01 +0000 |
commit | 9a93a32b717256d326877e7772ddb7e9ead8231a (patch) | |
tree | 974a3db2ceaf56d645995c3d650c4fcc50677a98 | |
parent | ad37de5ea29c316c3549a32e1f0b8ac1c16f0967 (diff) |
missing free()s; From: Patrick Latifi <pat@eyeo.org>
-rw-r--r-- | usr.sbin/bgpd/log.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/bgpd/log.c b/usr.sbin/bgpd/log.c index 616fe6174fb..ef363fa48a6 100644 --- a/usr.sbin/bgpd/log.c +++ b/usr.sbin/bgpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.12 2003/12/30 13:03:27 henning Exp $ */ +/* $OpenBSD: log.c,v 1.13 2003/12/30 18:47:00 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -178,6 +178,7 @@ log_peer_err(const struct peer *peer, const char *emsg, ...) vlog(LOG_CRIT, nfmt, ap); va_end(ap); free(p); + free(nfmt); } void @@ -193,6 +194,7 @@ log_peer_errx(const struct peer *peer, const char *emsg, ...) vlog(LOG_CRIT, nfmt, ap); va_end(ap); free(p); + free(nfmt); } void @@ -202,20 +204,21 @@ log_err(const char *emsg, ...) va_list ap; /* best effort to even work in out of memory situations */ - - va_start(ap, emsg); - if (emsg == NULL) logit(LOG_CRIT, "%s", strerror(errno)); else { + va_start(ap, emsg); + if (asprintf(&nfmt, "%s: %s", emsg, strerror(errno)) == -1) { /* we tried it... */ vlog(LOG_CRIT, emsg, ap); logit(LOG_CRIT, "%s", strerror(errno)); - } else + } else { vlog(LOG_CRIT, nfmt, ap); + free(nfmt); + } + va_end(ap); } - va_end(ap); } void |