diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-26 18:09:53 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-26 18:09:53 +0000 |
commit | 523c1b8a5688027350c34ec340499e014c41b482 (patch) | |
tree | 0e62ef20e9996884aadf60a8be147e6ecd1db937 /usr.bin/tmux | |
parent | fdc0bf87eb95d420be5d6ae20e2d09d895c0d1ae (diff) |
Initialise the arg2 pointer properly (also free it when freeing the
others). Fixes crashes with J in malloc_options reported by oga.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd-generic.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/tmux/cmd-generic.c b/usr.bin/tmux/cmd-generic.c index 734c071cbba..5b459dfa5bf 100644 --- a/usr.bin/tmux/cmd-generic.c +++ b/usr.bin/tmux/cmd-generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-generic.c,v 1.6 2009/08/11 12:53:37 nicm Exp $ */ +/* $OpenBSD: cmd-generic.c,v 1.7 2009/08/26 18:09:52 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -155,6 +155,7 @@ cmd_target_init(struct cmd *self, unused int key) data->chflags = 0; data->target = NULL; data->arg = NULL; + data->arg2 = NULL; } int @@ -204,6 +205,8 @@ cmd_target_free(struct cmd *self) xfree(data->target); if (data->arg != NULL) xfree(data->arg); + if (data->arg2 != NULL) + xfree(data->arg2); xfree(data); } @@ -236,6 +239,7 @@ cmd_srcdst_init(struct cmd *self, unused int key) data->src = NULL; data->dst = NULL; data->arg = NULL; + data->arg2 = NULL; } int @@ -290,6 +294,8 @@ cmd_srcdst_free(struct cmd *self) xfree(data->dst); if (data->arg != NULL) xfree(data->arg); + if (data->arg2 != NULL) + xfree(data->arg2); xfree(data); } @@ -324,6 +330,7 @@ cmd_buffer_init(struct cmd *self, unused int key) data->target = NULL; data->buffer = -1; data->arg = NULL; + data->arg2 = NULL; } int @@ -384,6 +391,8 @@ cmd_buffer_free(struct cmd *self) xfree(data->target); if (data->arg != NULL) xfree(data->arg); + if (data->arg2 != NULL) + xfree(data->arg2); xfree(data); } |