=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd.c,v retrieving revision 1.67 retrieving revision 1.68 diff -c -r1.67 -r1.68 *** src/usr.bin/tmux/cmd.c 2012/07/08 16:04:38 1.67 --- src/usr.bin/tmux/cmd.c 2012/07/10 11:53:01 1.68 *************** *** 1,4 **** ! /* $OpenBSD: cmd.c,v 1.67 2012/07/08 16:04:38 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd.c,v 1.68 2012/07/10 11:53:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 198,208 **** if (argc == 0) return; ! for (i = 0; i < argc; i++) { ! if (argv[i] != NULL) ! xfree(argv[i]); ! } ! xfree(argv); } struct cmd * --- 198,206 ---- if (argc == 0) return; ! for (i = 0; i < argc; i++) ! free(argv[i]); ! free(argv); } struct cmd * *************** *** 291,299 **** void cmd_free(struct cmd *cmd) { ! if (cmd->args != NULL) ! args_free(cmd->args); ! xfree(cmd); } size_t --- 289,296 ---- void cmd_free(struct cmd *cmd) { ! args_free(cmd->args); ! free(cmd); } size_t *************** *** 507,513 **** if (c == NULL) ctx->error(ctx, "client not found: %s", tmparg); ! xfree(tmparg); return (c); } --- 504,510 ---- if (c == NULL) ctx->error(ctx, "client not found: %s", tmparg); ! free(tmparg); return (c); } *************** *** 767,773 **** /* An empty session name is the current session. */ if (*tmparg == '\0') { ! xfree(tmparg); return (cmd_current_session(ctx, prefer_unattached)); } --- 764,770 ---- /* An empty session name is the current session. */ if (*tmparg == '\0') { ! free(tmparg); return (cmd_current_session(ctx, prefer_unattached)); } *************** *** 786,792 **** ctx->error(ctx, "session not found: %s", tmparg); } ! xfree(tmparg); return (s); } --- 783,789 ---- ctx->error(ctx, "session not found: %s", tmparg); } ! free(tmparg); return (s); } *************** *** 861,867 **** goto not_found; if (sessptr != NULL) ! xfree(sessptr); return (wl); no_colon: --- 858,864 ---- goto not_found; if (sessptr != NULL) ! free(sessptr); return (wl); no_colon: *************** *** 899,906 **** ctx->error(ctx, "multiple sessions: %s", arg); else ctx->error(ctx, "session not found: %s", arg); ! if (sessptr != NULL) ! xfree(sessptr); return (NULL); not_found: --- 896,902 ---- ctx->error(ctx, "multiple sessions: %s", arg); else ctx->error(ctx, "session not found: %s", arg); ! free(sessptr); return (NULL); not_found: *************** *** 908,915 **** ctx->error(ctx, "multiple windows: %s", arg); else ctx->error(ctx, "window not found: %s", arg); ! if (sessptr != NULL) ! xfree(sessptr); return (NULL); } --- 904,910 ---- ctx->error(ctx, "multiple windows: %s", arg); else ctx->error(ctx, "window not found: %s", arg); ! free(sessptr); return (NULL); } *************** *** 1000,1007 **** } else if ((idx = cmd_lookup_index(s, winptr, &ambiguous)) == -1) goto invalid_index; ! if (sessptr != NULL) ! xfree(sessptr); return (idx); no_colon: --- 995,1001 ---- } else if ((idx = cmd_lookup_index(s, winptr, &ambiguous)) == -1) goto invalid_index; ! free(sessptr); return (idx); no_colon: *************** *** 1040,1047 **** ctx->error(ctx, "multiple sessions: %s", arg); else ctx->error(ctx, "session not found: %s", arg); ! if (sessptr != NULL) ! xfree(sessptr); return (-2); invalid_index: --- 1034,1040 ---- ctx->error(ctx, "multiple sessions: %s", arg); else ctx->error(ctx, "session not found: %s", arg); ! free(sessptr); return (-2); invalid_index: *************** *** 1049,1056 **** goto not_found; ctx->error(ctx, "invalid index: %s", arg); ! if (sessptr != NULL) ! xfree(sessptr); return (-2); not_found: --- 1042,1048 ---- goto not_found; ctx->error(ctx, "invalid index: %s", arg); ! free(sessptr); return (-2); not_found: *************** *** 1058,1065 **** ctx->error(ctx, "multiple windows: %s", arg); else ctx->error(ctx, "window not found: %s", arg); ! if (sessptr != NULL) ! xfree(sessptr); return (-2); } --- 1050,1056 ---- ctx->error(ctx, "multiple windows: %s", arg); else ctx->error(ctx, "window not found: %s", arg); ! free(sessptr); return (-2); } *************** *** 1153,1159 **** goto lookup_string; } ! xfree(winptr); return (wl); lookup_string: --- 1144,1150 ---- goto lookup_string; } ! free(winptr); return (wl); lookup_string: *************** *** 1163,1169 **** goto error; } ! xfree(winptr); return (wl); no_period: --- 1154,1160 ---- goto error; } ! free(winptr); return (wl); no_period: *************** *** 1189,1195 **** return (wl); error: ! xfree(winptr); return (NULL); } --- 1180,1186 ---- return (wl); error: ! free(winptr); return (NULL); }