mirror of
				https://github.com/FreeRTOS/FreeRTOS-Kernel.git
				synced 2025-11-04 11:09:01 +01:00 
			
		
		
		
	event_create(): check malloc() return value to be non-NULL (#1084)
* event_create(): check malloc() to be non-NULL Check malloc() to return non-NULL before writing data in the function event_create(). Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com> * Code review suggestion Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> --------- Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com> Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
		
							parent
							
								
									11174fb860
								
							
						
					
					
						commit
						c431b358c8
					
				@ -43,9 +43,13 @@ struct event * event_create( void )
 | 
			
		||||
{
 | 
			
		||||
    struct event * ev = malloc( sizeof( struct event ) );
 | 
			
		||||
 | 
			
		||||
    if( ev != NULL )
 | 
			
		||||
    {
 | 
			
		||||
        ev->event_triggered = false;
 | 
			
		||||
        pthread_mutex_init( &ev->mutex, NULL );
 | 
			
		||||
        pthread_cond_init( &ev->cond, NULL );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return ev;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user