mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Sync OpenBSD patchset 208:
Don't leak when rollling buffers off when the paste buffer limit is reached.
This commit is contained in:
		
							
								
								
									
										8
									
								
								paste.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								paste.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: paste.c,v 1.7 2009-07-02 16:23:54 nicm Exp $ */
 | 
			
		||||
/* $Id: paste.c,v 1.8 2009-07-31 20:33:49 tcunha Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -104,8 +104,12 @@ paste_add(struct paste_stack *ps, char *data, u_int limit)
 | 
			
		||||
	if (*data == '\0')
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	while (ARRAY_LENGTH(ps) >= limit)
 | 
			
		||||
	while (ARRAY_LENGTH(ps) >= limit) {
 | 
			
		||||
		pb = ARRAY_LAST(ps);
 | 
			
		||||
		xfree(pb->data);
 | 
			
		||||
		xfree(pb);
 | 
			
		||||
		ARRAY_TRUNC(ps, 1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pb = xmalloc(sizeof *pb);
 | 
			
		||||
	ARRAY_INSERT(ps, 0, pb);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user