summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-08-09 08:34:18 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-08-09 08:34:18 +0000
commitc895e6d88f1a41c252ca761f25f081a86c918417 (patch)
tree480d7e9ce1590061194fa6a53de42d9d6ca9bed7
parentf21f0c147e1ed0728852a1a2a5da4c4fdddc79d9 (diff)
Don't leak in the (rare) case of an invalid command at the end of a file not
terminated by a \n.
-rw-r--r--usr.bin/tmux/cfg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c
index 085d1a5d141..99a200da38b 100644
--- a/usr.bin/tmux/cfg.c
+++ b/usr.bin/tmux/cfg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfg.c,v 1.3 2009/07/30 17:46:12 nicm Exp $ */
+/* $OpenBSD: cfg.c,v 1.4 2009/08/09 08:34:17 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -112,6 +112,8 @@ load_cfg(const char *path, char **cause)
return (0);
error:
+ if (line != NULL)
+ xfree(line);
fclose(f);
xasprintf(&ptr, "%s: %s at line %u", path, *cause, n);