File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -66,14 +66,14 @@ static conn_registry_t *acquire_registry(conn_mode_entry_t *entry, udp_socket_co
6666		registry  =  calloc (1 , sizeof (conn_registry_t ));
6767		if  (!registry ) {
6868			JLOG_FATAL ("Memory allocation failed for connections registry" );
69- 			return  NULL ;
69+ 			return  ( void * ) -1 ;
7070		}
7171
7272		registry -> agents  =  malloc (INITIAL_REGISTRY_SIZE  *  sizeof (juice_agent_t  * ));
7373		if  (!registry -> agents ) {
7474			JLOG_FATAL ("Memory allocation failed for connections array" );
7575			free (registry );
76- 			return  NULL ;
76+ 			return  ( void * ) -1 ;
7777		}
7878
7979		registry -> agents_size  =  INITIAL_REGISTRY_SIZE ;
@@ -84,10 +84,11 @@ static conn_registry_t *acquire_registry(conn_mode_entry_t *entry, udp_socket_co
8484		mutex_lock (& registry -> mutex );
8585
8686		if  (entry -> registry_init_func (registry , config )) {
87+ 			JLOG_FATAL ("Registry initialization failed" );
8788			mutex_unlock (& registry -> mutex );
8889			free (registry -> agents );
8990			free (registry );
90- 			return  NULL ;
91+ 			return  ( void * ) -1 ;
9192		}
9293
9394		entry -> registry  =  registry ;
@@ -132,6 +133,9 @@ int conn_create(juice_agent_t *agent, udp_socket_config_t *config) {
132133	mutex_lock (& entry -> mutex );
133134	conn_registry_t  * registry  =  acquire_registry (entry , config ); // locks the registry if created 
134135	mutex_unlock (& entry -> mutex );
136+ 	if (registry  ==  (void * )-1 ) {
137+ 		return  -1 ;
138+ 	}
135139
136140	JLOG_DEBUG ("Creating connection" );
137141	if  (registry ) {
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments