mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Fix a memory/fd leak reported by Tiago Cunha.
This commit is contained in:
		
							
								
								
									
										9
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								client.c
									
									
									
									
									
								
							@@ -118,10 +118,15 @@ retry:
 | 
			
		||||
		close(fd);
 | 
			
		||||
 | 
			
		||||
		xasprintf(&lockfile, "%s.lock", path);
 | 
			
		||||
		if ((lockfd = client_get_lock(lockfile)) == -1)
 | 
			
		||||
		if ((lockfd = client_get_lock(lockfile)) == -1) {
 | 
			
		||||
			free(lockfile);
 | 
			
		||||
			goto retry;
 | 
			
		||||
		if (unlink(path) != 0 && errno != ENOENT)
 | 
			
		||||
		}
 | 
			
		||||
		if (unlink(path) != 0 && errno != ENOENT) {
 | 
			
		||||
			free(lockfile);
 | 
			
		||||
			close(lockfd);
 | 
			
		||||
			return (-1);
 | 
			
		||||
		}
 | 
			
		||||
		fd = server_start(lockfd, lockfile);
 | 
			
		||||
		free(lockfile);
 | 
			
		||||
		close(lockfd);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user