=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-command-prompt.c,v retrieving revision 1.3 retrieving revision 1.4 diff -c -r1.3 -r1.4 *** src/usr.bin/tmux/cmd-command-prompt.c 2009/07/15 17:39:00 1.3 --- src/usr.bin/tmux/cmd-command-prompt.c 2009/07/17 06:13:27 1.4 *************** *** 1,4 **** ! /* $OpenBSD: cmd-command-prompt.c,v 1.3 2009/07/15 17:39:00 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-command-prompt.c,v 1.4 2009/07/17 06:13:27 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott *************** *** 31,36 **** --- 31,37 ---- int cmd_command_prompt_exec(struct cmd *, struct cmd_ctx *); int cmd_command_prompt_callback(void *, const char *); + void cmd_command_prompt_free(void *); const struct cmd_entry cmd_command_prompt_entry = { "command-prompt", NULL, *************** *** 96,102 **** cdata->template = NULL; hdr = xstrdup(":"); } ! status_prompt_set(c, hdr, cmd_command_prompt_callback, cdata, 0); xfree(hdr); return (0); --- 97,104 ---- cdata->template = NULL; hdr = xstrdup(":"); } ! status_prompt_set(c, hdr, ! cmd_command_prompt_callback, cmd_command_prompt_free, cdata, 0); xfree(hdr); return (0); *************** *** 112,121 **** char *cause, *ptr, *buf, ch; size_t len, slen; ! if (s == NULL) { ! xfree(cdata); return (0); - } slen = strlen(s); len = 0; --- 114,121 ---- char *cause, *ptr, *buf, ch; size_t len, slen; ! if (s == NULL) return (0); slen = strlen(s); len = 0; *************** *** 139,150 **** break; } } - xfree(cdata->template); buf[len] = '\0'; s = buf; } - xfree(cdata); if (cmd_string_parse(s, &cmdlist, &cause) != 0) { if (cause == NULL) --- 139,148 ---- *************** *** 172,178 **** cmd_list_exec(cmdlist, &ctx); cmd_list_free(cmdlist); ! if (c->prompt_callback != (void *) &cmd_command_prompt_callback) return (1); return (0); } --- 170,186 ---- cmd_list_exec(cmdlist, &ctx); cmd_list_free(cmdlist); ! if (c->prompt_callbackfn != (void *) &cmd_command_prompt_callback) return (1); return (0); + } + + void + cmd_command_prompt_free(void *data) + { + struct cmd_command_prompt_data *cdata = data; + + if (cdata->template != NULL) + xfree(cdata->template); + xfree(cdata); }