Browse Source

cmapctl: Free bin_value on error

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Jan Friesse 6 years ago
parent
commit
8ff7760ce5
1 changed files with 6 additions and 0 deletions
  1. 6 0
      tools/corosync-cmapctl.c

+ 6 - 0
tools/corosync-cmapctl.c

@@ -316,6 +316,12 @@ static void print_key(cmap_handle_t handle,
 	if (err != CS_OK) {
 		fprintf(stderr, "Can't get value of %s. Error %s\n", key_name, cs_strerror(err));
 
+		/*
+		 * bin_value was newly allocated
+		 */
+		if (bin_value != NULL && value == NULL) {
+			free(bin_value);
+		}
 		return ;
 	}