From 4573ef18691bb5492089265f335dc661aa9fc657 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 16 Feb 2009 18:57:16 +0000 Subject: [PATCH] Memory leak. --- cmd-command-prompt.c | 6 ++++-- cmd-list.c | 8 +++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index c46d2dc7..6f0c8fc5 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -1,4 +1,4 @@ -/* $Id: cmd-command-prompt.c,v 1.14 2009-02-13 18:57:55 nicm Exp $ */ +/* $Id: cmd-command-prompt.c,v 1.15 2009-02-16 18:57:16 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -112,8 +112,10 @@ cmd_command_prompt_callback(void *data, const char *s) char *cause, *ptr, *buf, ch; size_t len, slen; - if (s == NULL) + if (s == NULL) { + xfree(cdata); return (0); + } slen = strlen(s); len = 0; diff --git a/cmd-list.c b/cmd-list.c index 870de3da..963d49fe 100644 --- a/cmd-list.c +++ b/cmd-list.c @@ -1,4 +1,4 @@ -/* $Id: cmd-list.c,v 1.2 2009-01-19 18:23:40 nicm Exp $ */ +/* $Id: cmd-list.c,v 1.3 2009-02-16 18:57:16 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -47,10 +47,8 @@ cmd_list_parse(int argc, char **argv, char **cause) } cmd = cmd_parse(argc - lastsplit, argv + lastsplit, cause); - if (cmd == NULL) { - cmd_list_free(cmdlist); - return (NULL); - } + if (cmd == NULL) + goto bad; TAILQ_INSERT_TAIL(cmdlist, cmd, qentry); return (cmdlist);