mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-11-03 22:13:11 +03:00 
			
		
		
		
	examples/x11.c: fix invalid removal of first list element
Fix use of memory after it was being freed. Detected by clang scan in line 56, column 12.
This commit is contained in:
		@@ -48,9 +48,9 @@ static void remove_node(struct chan_X11_list *elem)
 | 
			
		||||
    current_node = gp_x11_chan;
 | 
			
		||||
 | 
			
		||||
    if (gp_x11_chan == elem) {
 | 
			
		||||
        /* Removing the only one element in the list */
 | 
			
		||||
        free(gp_x11_chan);
 | 
			
		||||
        gp_x11_chan = NULL;
 | 
			
		||||
        gp_x11_chan = gp_x11_chan->next;
 | 
			
		||||
        free(current_node);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    while (current_node->next != NULL) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user