Kaynağa Gözat

vsf_quorum: fix potential memory leak

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Angus Salkeld <asalked@redhat.com>
Fabio M. Di Nitto 14 yıl önce
ebeveyn
işleme
de914ca73b
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6 1
      exec/vsf_quorum.c

+ 6 - 1
exec/vsf_quorum.c

@@ -252,7 +252,7 @@ static struct quorum_callin_functions callins = {
 
 
 static int quorum_exec_init_fn (struct corosync_api_v1 *api)
 static int quorum_exec_init_fn (struct corosync_api_v1 *api)
 {
 {
-	char *quorum_module;
+	char *quorum_module = NULL;
 
 
 #ifdef COROSYNC_SOLARIS
 #ifdef COROSYNC_SOLARIS
 	logsys_subsys_init();
 	logsys_subsys_init();
@@ -280,6 +280,11 @@ static int quorum_exec_init_fn (struct corosync_api_v1 *api)
 		}
 		}
 	}
 	}
 
 
+	if (quorum_module) {
+		free(quorum_module);
+		quorum_module = NULL;
+	}
+
 	/*
 	/*
 	 * setting quorum_type and primary_designated in the right order is important
 	 * setting quorum_type and primary_designated in the right order is important
 	 * always try to lookup/init a quorum module, then revert back to be quorate
 	 * always try to lookup/init a quorum module, then revert back to be quorate