From 2f5144ae1b5cfcc64066cf2025de155577e045df Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Sun, 15 Apr 2012 03:12:31 +0000 Subject: fix some leaks ok krw@ --- usr.sbin/relayd/parse.y | 3 ++- usr.sbin/relayd/relayd.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'usr.sbin/relayd') diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index a6427c58b3f..a45c43692e2 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.161 2012/01/21 13:40:48 camield Exp $ */ +/* $OpenBSD: parse.y,v 1.162 2012/04/15 03:12:30 jsg Exp $ */ /* * Copyright (c) 2007-2011 Reyk Floeter @@ -2691,6 +2691,7 @@ table_inherit(struct table *tb) h->conf.id = ++last_host_id; if (last_host_id == INT_MAX) { yyerror("too many hosts defined"); + free(h); goto fail; } h->conf.tableid = tb->conf.id; diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c index 141692c22e0..dd3410916ad 100644 --- a/usr.sbin/relayd/relayd.c +++ b/usr.sbin/relayd/relayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.c,v 1.106 2012/01/21 13:40:48 camield Exp $ */ +/* $OpenBSD: relayd.c,v 1.107 2012/04/15 03:12:30 jsg Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter @@ -813,6 +813,7 @@ expand_string(char *label, size_t len, const char *srch, const char *repl) if ((strlcat(tmp, p, len) >= len) || (strlcat(tmp, repl, len) >= len)) { log_debug("%s: string too long", __func__); + free(tmp); return (-1); } q += strlen(srch); @@ -820,6 +821,7 @@ expand_string(char *label, size_t len, const char *srch, const char *repl) } if (strlcat(tmp, p, len) >= len) { log_debug("%s: string too long", __func__); + free(tmp); return (-1); } (void)strlcpy(label, tmp, len); /* always fits */ -- cgit v1.2.3