Просмотр исходного кода

remove useless if-before-free tests

* exec/coropoll.c (poll_destroy): Remove useless if.
* exec/main.c (main): Likewise.
* include/corosync/hdb.h (hdb_destroy): Likewise.
* lcr/lcr_ifact.c (scandir): Likewise.
* lib/sa-confdb.c (load_config): Likewise.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2106 fd59a12c-fef9-0310-b244-a6a79926bd2f
Jim Meyering 17 лет назад
Родитель
Сommit
de3175bc69
5 измененных файлов с 6 добавлено и 16 удалено
  1. 2 6
      exec/coropoll.c
  2. 1 2
      exec/main.c
  3. 1 3
      include/corosync/hdb.h
  4. 1 3
      lcr/lcr_ifact.c
  5. 1 2
      lib/sa-confdb.c

+ 2 - 6
exec/coropoll.c

@@ -109,12 +109,8 @@ int poll_destroy (hdb_handle_t handle)
 		goto error_exit;
 	}
 
-	if (poll_instance->poll_entries) {
-		free (poll_instance->poll_entries);
-	}
-	if (poll_instance->ufds) {
-		free (poll_instance->ufds);
-	}
+	free (poll_instance->poll_entries);
+	free (poll_instance->ufds);
 
 	hdb_handle_destroy (&poll_instance_database, handle);
 

+ 1 - 2
exec/main.c

@@ -818,8 +818,7 @@ int main (int argc, char **argv)
 
 		iface = strtok(NULL, ":");
 	}
-	if (config_iface)
-		free(config_iface);
+	free(config_iface);
 
 	res = corosync_main_config_read (objdb, &error_string, &ug_config);
 	if (res == -1) {

+ 1 - 3
include/corosync/hdb.h

@@ -139,9 +139,7 @@ static inline void hdb_create (
 static inline void hdb_destroy (
 	struct hdb_handle_database *handle_database)
 {
-	if (handle_database->handles) {
-		free (handle_database->handles);
-	}
+	free (handle_database->handles);
 	hdb_database_lock_destroy (&handle_database->lock);
 	memset (handle_database, 0, sizeof (struct hdb_handle_database));
 }

+ 1 - 3
lcr/lcr_ifact.c

@@ -341,9 +341,7 @@ fail:
 		namelist_items--;
 		free (*namelist[namelist_items]);
 	}
-	if (names != NULL) {
-		free (names);
-	}
+	free (names);
 	*namelist = NULL;
 	errno = err;
 	return -1;

+ 1 - 2
lib/sa-confdb.c

@@ -137,8 +137,7 @@ static int load_config(void)
 
 		iface = strtok(NULL, ":");
 	}
-	if (config_iface)
-		free(config_iface);
+	free(config_iface);
 
 	return CS_OK;
 }