mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	evbuffer_readline returns allocated storage, don't leak it.
This commit is contained in:
		@@ -93,7 +93,6 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
	server_status_session_group(s);
 | 
						server_status_session_group(s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (args_has(args, 'P')) {
 | 
						if (args_has(args, 'P')) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
		if ((template = args_get(args, 'F')) == NULL)
 | 
							if ((template = args_get(args, 'F')) == NULL)
 | 
				
			||||||
			template = BREAK_PANE_TEMPLATE;
 | 
								template = BREAK_PANE_TEMPLATE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -112,6 +112,7 @@ cmd_run_shell_callback(struct job *job)
 | 
				
			|||||||
	do {
 | 
						do {
 | 
				
			||||||
		if ((line = evbuffer_readline(job->event->input)) != NULL) {
 | 
							if ((line = evbuffer_readline(job->event->input)) != NULL) {
 | 
				
			||||||
			cmd_run_shell_print (job, line);
 | 
								cmd_run_shell_print (job, line);
 | 
				
			||||||
 | 
								free(line);
 | 
				
			||||||
			lines++;
 | 
								lines++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} while (line != NULL);
 | 
						} while (line != NULL);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								status.c
									
									
									
									
									
								
							@@ -676,7 +676,7 @@ status_job_callback(struct job *job)
 | 
				
			|||||||
			memcpy(buf, EVBUFFER_DATA(job->event->input), len);
 | 
								memcpy(buf, EVBUFFER_DATA(job->event->input), len);
 | 
				
			||||||
		buf[len] = '\0';
 | 
							buf[len] = '\0';
 | 
				
			||||||
	} else
 | 
						} else
 | 
				
			||||||
		buf = xstrdup(line);
 | 
							buf = line;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	so->out = buf;
 | 
						so->out = buf;
 | 
				
			||||||
	server_status_client(c);
 | 
						server_status_client(c);
 | 
				
			||||||
@@ -1042,7 +1042,7 @@ status_prompt_key(struct client *c, int key)
 | 
				
			|||||||
	size_t			 size, n, off, idx;
 | 
						size_t			 size, n, off, idx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size = strlen(c->prompt_buffer);
 | 
						size = strlen(c->prompt_buffer);
 | 
				
			||||||
	switch (mode_key_lookup(&c->prompt_mdata, key)) {
 | 
						switch (mode_key_lookup(&c->prompt_mdata, key, NULL)) {
 | 
				
			||||||
	case MODEKEYEDIT_CURSORLEFT:
 | 
						case MODEKEYEDIT_CURSORLEFT:
 | 
				
			||||||
		if (c->prompt_index > 0) {
 | 
							if (c->prompt_index > 0) {
 | 
				
			||||||
			c->prompt_index--;
 | 
								c->prompt_index--;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user