mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Double-free on session destroy.
This commit is contained in:
		
							
								
								
									
										12
									
								
								session.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								session.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: session.c,v 1.28 2007-10-31 14:26:26 nicm Exp $ */
 | 
			
		||||
/* $Id: session.c,v 1.29 2007-11-12 16:39:30 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -124,8 +124,7 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy)
 | 
			
		||||
void
 | 
			
		||||
session_destroy(struct session *s)
 | 
			
		||||
{
 | 
			
		||||
	struct winlink	*wl;
 | 
			
		||||
	u_int		 i;
 | 
			
		||||
	u_int	i;
 | 
			
		||||
 | 
			
		||||
	if (session_index(s, &i) != 0)
 | 
			
		||||
		fatalx("session not found");
 | 
			
		||||
@@ -133,11 +132,8 @@ session_destroy(struct session *s)
 | 
			
		||||
	while (!ARRAY_EMPTY(&sessions) && ARRAY_LAST(&sessions) == NULL)
 | 
			
		||||
		ARRAY_TRUNC(&sessions, 1);
 | 
			
		||||
	
 | 
			
		||||
	while (!RB_EMPTY(&s->windows)) {
 | 
			
		||||
		wl = RB_ROOT(&s->windows);
 | 
			
		||||
		RB_REMOVE(winlinks, &s->windows, wl);
 | 
			
		||||
		winlink_remove(&s->windows, wl);
 | 
			
		||||
	}
 | 
			
		||||
	while (!RB_EMPTY(&s->windows))
 | 
			
		||||
		winlink_remove(&s->windows, RB_ROOT(&s->windows));
 | 
			
		||||
 | 
			
		||||
	xfree(s->name);
 | 
			
		||||
	xfree(s);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user