mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Fixes for memory leaks reported by Lu Ming Yin, fixes from Howard Chu.
This commit is contained in:
		| @@ -171,6 +171,8 @@ args_parse_flag_argument(struct args_value *values, u_int count, char **cause, | |||||||
| 		if (optional_argument) { | 		if (optional_argument) { | ||||||
| 			log_debug("%s: -%c (optional)", __func__, flag); | 			log_debug("%s: -%c (optional)", __func__, flag); | ||||||
| 			args_set(args, flag, NULL, ARGS_ENTRY_OPTIONAL_VALUE); | 			args_set(args, flag, NULL, ARGS_ENTRY_OPTIONAL_VALUE); | ||||||
|  | 			args_free_value(new); | ||||||
|  | 			free(new); | ||||||
| 			return (0); /* either - or end */ | 			return (0); /* either - or end */ | ||||||
| 		} | 		} | ||||||
| 		xasprintf(cause, "-%c expects an argument", flag); | 		xasprintf(cause, "-%c expects an argument", flag); | ||||||
| @@ -662,6 +664,8 @@ args_set(struct args *args, u_char flag, struct args_value *value, int flags) | |||||||
| 		entry->count++; | 		entry->count++; | ||||||
| 	if (value != NULL && value->type != ARGS_NONE) | 	if (value != NULL && value->type != ARGS_NONE) | ||||||
| 		TAILQ_INSERT_TAIL(&entry->values, value, entry); | 		TAILQ_INSERT_TAIL(&entry->values, value, entry); | ||||||
|  | 	else | ||||||
|  | 		free(value); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Get argument value. Will be NULL if it isn't present. */ | /* Get argument value. Will be NULL if it isn't present. */ | ||||||
|   | |||||||
| @@ -143,6 +143,7 @@ cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 		cdata->prompt_type = status_prompt_type(type); | 		cdata->prompt_type = status_prompt_type(type); | ||||||
| 		if (cdata->prompt_type == PROMPT_TYPE_INVALID) { | 		if (cdata->prompt_type == PROMPT_TYPE_INVALID) { | ||||||
| 			cmdq_error(item, "unknown type: %s", type); | 			cmdq_error(item, "unknown type: %s", type); | ||||||
|  | 			cmd_command_prompt_free(cdata); | ||||||
| 			return (CMD_RETURN_ERROR); | 			return (CMD_RETURN_ERROR); | ||||||
| 		} | 		} | ||||||
| 	} else | 	} else | ||||||
|   | |||||||
| @@ -76,8 +76,10 @@ cmd_confirm_before_exec(struct cmd *self, struct cmdq_item *item) | |||||||
|  |  | ||||||
| 	cdata = xcalloc(1, sizeof *cdata); | 	cdata = xcalloc(1, sizeof *cdata); | ||||||
| 	cdata->cmdlist = args_make_commands_now(self, item, 0, 1); | 	cdata->cmdlist = args_make_commands_now(self, item, 0, 1); | ||||||
| 	if (cdata->cmdlist == NULL) | 	if (cdata->cmdlist == NULL) { | ||||||
|  | 		free(cdata); | ||||||
| 		return (CMD_RETURN_ERROR); | 		return (CMD_RETURN_ERROR); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if (wait) | 	if (wait) | ||||||
| 		cdata->item = item; | 		cdata->item = item; | ||||||
|   | |||||||
| @@ -230,7 +230,7 @@ layout_parse(struct window *w, const char *layout, char **cause) | |||||||
| 	/* Check the new layout. */ | 	/* Check the new layout. */ | ||||||
| 	if (!layout_check(lc)) { | 	if (!layout_check(lc)) { | ||||||
| 		*cause = xstrdup("size mismatch after applying layout"); | 		*cause = xstrdup("size mismatch after applying layout"); | ||||||
| 		return (-1); | 		goto fail; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* Resize to the layout size. */ | 	/* Resize to the layout size. */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm