mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Memory leak/missing init.
This commit is contained in:
parent
a8e3e989dd
commit
4c166484f4
4
array.h
4
array.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: array.h,v 1.2 2007-08-27 08:08:19 nicm Exp $ */
|
/* $Id: array.h,v 1.3 2008-06-16 07:01:40 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -59,7 +59,7 @@
|
|||||||
#define ARRAY_REMOVE(a, i) do { \
|
#define ARRAY_REMOVE(a, i) do { \
|
||||||
if (((u_int) (i)) >= (a)->num) \
|
if (((u_int) (i)) >= (a)->num) \
|
||||||
abort(); \
|
abort(); \
|
||||||
if (i < (a)->num - 1) { \
|
if ((i) < (a)->num - 1) { \
|
||||||
memmove((a)->list + (i), (a)->list + (i) + 1, \
|
memmove((a)->list + (i), (a)->list + (i) + 1, \
|
||||||
ARRAY_ITEMSIZE(a) * ((a)->num - (i) - 1)); \
|
ARRAY_ITEMSIZE(a) * ((a)->num - (i) - 1)); \
|
||||||
} \
|
} \
|
||||||
|
3
cmd.c
3
cmd.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd.c,v 1.46 2008-06-16 06:10:02 nicm Exp $ */
|
/* $Id: cmd.c,v 1.47 2008-06-16 07:01:41 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -112,6 +112,7 @@ cmd_parse(int argc, char **argv, char **cause)
|
|||||||
|
|
||||||
cmd = xmalloc(sizeof *cmd);
|
cmd = xmalloc(sizeof *cmd);
|
||||||
cmd->entry = entry;
|
cmd->entry = entry;
|
||||||
|
cmd->data = NULL;
|
||||||
if (entry->parse != NULL) {
|
if (entry->parse != NULL) {
|
||||||
if (entry->parse(cmd, argc, argv, cause) != 0) {
|
if (entry->parse(cmd, argc, argv, cause) != 0) {
|
||||||
xfree(cmd);
|
xfree(cmd);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: key-bindings.c,v 1.29 2008-06-05 16:35:32 nicm Exp $ */
|
/* $Id: key-bindings.c,v 1.30 2008-06-16 07:01:41 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -44,7 +44,8 @@ key_bindings_add(int key, struct cmd *cmd)
|
|||||||
if (i == ARRAY_LENGTH(&key_bindings)) {
|
if (i == ARRAY_LENGTH(&key_bindings)) {
|
||||||
bd = xmalloc(sizeof *bd);
|
bd = xmalloc(sizeof *bd);
|
||||||
ARRAY_ADD(&key_bindings, bd);
|
ARRAY_ADD(&key_bindings, bd);
|
||||||
}
|
} else
|
||||||
|
cmd_free(bd->cmd);
|
||||||
|
|
||||||
bd->key = key;
|
bd->key = key;
|
||||||
bd->cmd = cmd;
|
bd->cmd = cmd;
|
||||||
|
Loading…
Reference in New Issue
Block a user