mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Initialise the arg2 pointer properly (also free it when freeing the
others). Fixes crashes with J in malloc_options reported by oga.
This commit is contained in:
		@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user