diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-03-10 17:30:32 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-03-10 17:30:32 +0000 |
commit | dc07874d6387c0fca1c5a02f18b7997e83075ae4 (patch) | |
tree | 900fb98ed1b1c3717398c388eea5ffcb26503640 /sbin | |
parent | 0af84545ac79c2b8af7e67b81b81ea23f2470dcb (diff) |
Avoid memory leak if strdup should fail.
OK hshoexer@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/isakmpd/conf.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/isakmpd/conf.c b/sbin/isakmpd/conf.c index eb3f504837d..5b9c1cadc8e 100644 --- a/sbin/isakmpd/conf.c +++ b/sbin/isakmpd/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.74 2004/12/14 10:17:28 mcbride Exp $ */ +/* $OpenBSD: conf.c,v 1.75 2005/03/10 17:30:31 cloder Exp $ */ /* $EOM: conf.c,v 1.48 2000/12/04 02:04:29 angelos Exp $ */ /* @@ -708,7 +708,7 @@ conf_get_list(char *section, char *tag) { char *liststr = 0, *p, *field, *t; struct conf_list *list = 0; - struct conf_list_node *node; + struct conf_list_node *node = 0; list = malloc(sizeof *list); if (!list) @@ -747,6 +747,8 @@ conf_get_list(char *section, char *tag) return list; cleanup: + if (node) + free(node); if (list) conf_free_list(list); if (liststr) @@ -758,7 +760,7 @@ struct conf_list * conf_get_tag_list(char *section) { struct conf_list *list = 0; - struct conf_list_node *node; + struct conf_list_node *node = 0; struct conf_binding *cb; list = malloc(sizeof *list); @@ -781,6 +783,8 @@ conf_get_tag_list(char *section) return list; cleanup: + if (node) + free(node); if (list) conf_free_list(list); return 0; |