Procházet zdrojové kódy

cmapctl: initialize bit_value and check if it's set

more gcc warnings...

Reviewed-by: Steven Dake <sdake@redhat.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Fabio M. Di Nitto před 14 roky
rodič
revize
d73ba6dd87
1 změnil soubory, kde provedl 8 přidání a 4 odebrání
  1. 8 4
      tools/corosync-cmapctl.c

+ 8 - 4
tools/corosync-cmapctl.c

@@ -148,7 +148,7 @@ static void print_key(cmap_handle_t handle,
 		cmap_value_types_t type)
 		cmap_value_types_t type)
 {
 {
 	char *str;
 	char *str;
-	char *bin_value;
+	char *bin_value = NULL;
 	cs_error_t err;
 	cs_error_t err;
 	int8_t i8;
 	int8_t i8;
 	uint8_t u8;
 	uint8_t u8;
@@ -327,9 +327,13 @@ static void print_key(cmap_handle_t handle,
 		printf("%s)", "bin");
 		printf("%s)", "bin");
 		if (show_binary) {
 		if (show_binary) {
 			printf(" = ");
 			printf(" = ");
-			print_binary_key(bin_value, value_len);
-			if (value == NULL) {
-				free(bin_value);
+			if (bin_value) {
+				print_binary_key(bin_value, value_len);
+				if (value == NULL) {
+					free(bin_value);
+				}
+			} else {
+				printf("*empty*");
 			}
 			}
 		}
 		}
 		break;
 		break;