mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	xfree is not particularly helpful, remove it. From Thomas Adam.
This commit is contained in:
		
							
								
								
									
										37
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								window.c
									
									
									
									
									
								
							@@ -179,9 +179,8 @@ winlink_remove(struct winlinks *wwl, struct winlink *wl)
 | 
			
		||||
	struct window	*w = wl->window;
 | 
			
		||||
 | 
			
		||||
	RB_REMOVE(winlinks, wwl, wl);
 | 
			
		||||
	if (wl->status_text != NULL)
 | 
			
		||||
		xfree(wl->status_text);
 | 
			
		||||
	xfree(wl);
 | 
			
		||||
	free(wl->status_text);
 | 
			
		||||
	free(wl);
 | 
			
		||||
 | 
			
		||||
	if (w != NULL) {
 | 
			
		||||
		if (w->references == 0)
 | 
			
		||||
@@ -359,16 +358,14 @@ window_destroy(struct window *w)
 | 
			
		||||
 | 
			
		||||
	window_destroy_panes(w);
 | 
			
		||||
 | 
			
		||||
	if (w->name != NULL)
 | 
			
		||||
		xfree(w->name);
 | 
			
		||||
	xfree(w);
 | 
			
		||||
	free(w->name);
 | 
			
		||||
	free(w);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
window_set_name(struct window *w, const char *new_name)
 | 
			
		||||
{
 | 
			
		||||
	if (w->name != NULL)
 | 
			
		||||
		xfree(w->name);
 | 
			
		||||
	free(w->name);
 | 
			
		||||
	w->name = xstrdup(new_name);
 | 
			
		||||
	notify_window_renamed(w);
 | 
			
		||||
}
 | 
			
		||||
@@ -671,13 +668,10 @@ window_pane_destroy(struct window_pane *wp)
 | 
			
		||||
 | 
			
		||||
	RB_REMOVE(window_pane_tree, &all_window_panes, wp);
 | 
			
		||||
 | 
			
		||||
	if (wp->cwd != NULL)
 | 
			
		||||
		xfree(wp->cwd);
 | 
			
		||||
	if (wp->shell != NULL)
 | 
			
		||||
		xfree(wp->shell);
 | 
			
		||||
	if (wp->cmd != NULL)
 | 
			
		||||
		xfree(wp->cmd);
 | 
			
		||||
	xfree(wp);
 | 
			
		||||
	free(wp->cwd);
 | 
			
		||||
	free(wp->shell);
 | 
			
		||||
	free(wp->cmd);
 | 
			
		||||
	free(wp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
@@ -694,18 +688,15 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
 | 
			
		||||
		close(wp->fd);
 | 
			
		||||
	}
 | 
			
		||||
	if (cmd != NULL) {
 | 
			
		||||
		if (wp->cmd != NULL)
 | 
			
		||||
			xfree(wp->cmd);
 | 
			
		||||
		free(wp->cmd);
 | 
			
		||||
		wp->cmd = xstrdup(cmd);
 | 
			
		||||
	}
 | 
			
		||||
	if (shell != NULL) {
 | 
			
		||||
		if (wp->shell != NULL)
 | 
			
		||||
			xfree(wp->shell);
 | 
			
		||||
		free(wp->shell);
 | 
			
		||||
		wp->shell = xstrdup(shell);
 | 
			
		||||
	}
 | 
			
		||||
	if (cwd != NULL) {
 | 
			
		||||
		if (wp->cwd != NULL)
 | 
			
		||||
			xfree(wp->cwd);
 | 
			
		||||
		free(wp->cwd);
 | 
			
		||||
		wp->cwd = xstrdup(cwd);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1048,10 +1039,10 @@ window_pane_search(struct window_pane *wp, const char *searchstr, u_int *lineno)
 | 
			
		||||
				*lineno = i;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		xfree(line);
 | 
			
		||||
		free(line);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	xfree(newsearchstr);
 | 
			
		||||
	free(newsearchstr);
 | 
			
		||||
	return (msg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user