(!1970) Xext: sync: protect init_system_idle_counter() from allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									4bb65785c2
								
							
						
					
					
						commit
						ea2749496b
					
				
							
								
								
									
										12
									
								
								Xext/sync.c
								
								
								
								
							
							
						
						
									
										12
									
								
								Xext/sync.c
								
								
								
								
							| 
						 | 
				
			
			@ -2818,20 +2818,24 @@ init_system_idle_counter(const char *name, int deviceid)
 | 
			
		|||
 | 
			
		||||
    IdleTimeQueryValue(NULL, &idle);
 | 
			
		||||
 | 
			
		||||
    IdleCounterPriv *priv = calloc(1, sizeof(IdleCounterPriv));
 | 
			
		||||
    if (!priv)
 | 
			
		||||
        return NULL;
 | 
			
		||||
 | 
			
		||||
    idle_time_counter = SyncCreateSystemCounter(name, idle, resolution,
 | 
			
		||||
                                                XSyncCounterUnrestricted,
 | 
			
		||||
                                                IdleTimeQueryValue,
 | 
			
		||||
                                                IdleTimeBracketValues);
 | 
			
		||||
 | 
			
		||||
    if (idle_time_counter != NULL) {
 | 
			
		||||
        IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
 | 
			
		||||
    if (!idle_time_counter) {
 | 
			
		||||
        free(priv);
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    priv->value_less = priv->value_greater = NULL;
 | 
			
		||||
    priv->deviceid = deviceid;
 | 
			
		||||
 | 
			
		||||
    idle_time_counter->pSysCounterInfo->private = priv;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return idle_time_counter;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue