소스 검색

Always allocate totemrrp stats array

This prevents segfault when rrp mode is set with only one ring.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Jan Friesse 14 년 전
부모
커밋
f89d7b715f
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      exec/totemrrp.c

+ 2 - 4
exec/totemrrp.c

@@ -1879,10 +1879,8 @@ int totemrrp_initialize (
 
 	instance->totem_config = totem_config;
 	stats->rrp = &instance->stats;
-	if (totem_config->interface_count > 1) {
-		instance->stats.interface_count = totem_config->interface_count;
-		instance->stats.faulty = calloc(instance->stats.interface_count, sizeof(uint8_t));
-	}
+	instance->stats.interface_count = totem_config->interface_count;
+	instance->stats.faulty = calloc(instance->stats.interface_count, sizeof(uint8_t));
 
 	res = totemrrp_algorithm_set (
 		instance->totem_config,