summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2013-06-03 16:04:04 +0000
committerEric Faurot <eric@cvs.openbsd.org>2013-06-03 16:04:04 +0000
commit2d1f38e979cea2a7a983dac54284972159772e5f (patch)
treef4fe1e38136349375f4fdf4a55d70bff9dd47e4c
parentc91bd628edd89b9e31a1f3e4c33a5661d6866206 (diff)
plug a couple of memleaks
-rw-r--r--usr.sbin/smtpd/mta.c21
-rw-r--r--usr.sbin/smtpd/mta_session.c4
2 files changed, 17 insertions, 8 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index df79762fef5..14689b42c4e 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.157 2013/05/24 17:03:14 eric Exp $ */
+/* $OpenBSD: mta.c,v 1.158 2013/06/03 16:04:03 eric Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -1254,12 +1254,14 @@ mta_relay_unref(struct mta_relay *relay)
log_debug("debug: mta: freeing %s", mta_relay_to_text(relay));
SPLAY_REMOVE(mta_relay_tree, &relays, relay);
- if (relay->cert)
- free(relay->cert);
- if (relay->authtable)
- free(relay->authtable);
- if (relay->authlabel)
- free(relay->authlabel);
+
+ free(relay->authlabel);
+ free(relay->authtable);
+ free(relay->backupname);
+ free(relay->cert);
+ free(relay->helotable);
+ free(relay->secret);
+ free(relay->sourcetable);
while ((tree_poproot(&relay->connectors, NULL, (void**)&c)))
mta_connector_free(c);
@@ -1419,6 +1421,7 @@ mta_host_unref(struct mta_host *h)
SPLAY_REMOVE(mta_host_tree, &hosts, h);
free(h->sa);
free(h->ptrname);
+ free(h);
stat_decrement("mta.host", 1);
}
@@ -1494,6 +1497,7 @@ mta_domain_unref(struct mta_domain *d)
SPLAY_REMOVE(mta_domain_tree, &domains, d);
free(d->name);
+ free(d);
stat_decrement("mta.domain", 1);
}
@@ -1548,6 +1552,7 @@ mta_source_unref(struct mta_source *s)
SPLAY_REMOVE(mta_source_tree, &sources, s);
free(s->sa);
+ free(s);
stat_decrement("mta.source", 1);
}
@@ -1607,6 +1612,7 @@ mta_connector_free(struct mta_connector *c)
c->relay->nconnector--;
TAILQ_REMOVE(c->queue, c, lst_entry);
mta_source_unref(c->source);
+ free(c);
stat_decrement("mta.connector", 1);
}
@@ -1661,6 +1667,7 @@ mta_route_unref(struct mta_route *r)
SPLAY_REMOVE(mta_route_tree, &routes, r);
mta_source_unref(r->src); /* from constructor */
mta_host_unref(r->dst); /* from constructor */
+ free(r);
stat_decrement("mta.route", 1);
}
diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c
index 0615d691f24..9a6d12e6288 100644
--- a/usr.sbin/smtpd/mta_session.c
+++ b/usr.sbin/smtpd/mta_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta_session.c,v 1.36 2013/05/24 17:03:14 eric Exp $ */
+/* $OpenBSD: mta_session.c,v 1.37 2013/06/03 16:04:03 eric Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -319,6 +319,8 @@ mta_session_imsg(struct mproc *p, struct imsg *imsg)
bzero(resp_ca_cert->cert, resp_ca_cert->cert_len);
bzero(resp_ca_cert->key, resp_ca_cert->key_len);
+ free(resp_ca_cert->cert);
+ free(resp_ca_cert->key);
free(resp_ca_cert);
return;