no these are not useless.

Regards
-steve

On Mon, 2009-04-20 at 16:48 +0200, Jim Meyering wrote:
> This change removes some useless if-before-free tests.
> FYI, it was all done mechanically.
> 
> For rationale, portability discussion, etc, see these:
>   http://thread.gmane.org/gmane.comp.version-control.git/74187
>   http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/12712
>   http://thread.gmane.org/gmane.emacs.devel/98144
>   http://thread.gmane.org/gmane.comp.lib.glibc.alpha/13092
> 
> From 95b970874b21705884ce45e4c3c44d5fc2318968 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <[email protected]>
> Date: Mon, 20 Apr 2009 16:43:34 +0200
> Subject: [PATCH] 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.
> ---
>  exec/coropoll.c        |    8 ++------
>  exec/main.c            |    3 +--
>  include/corosync/hdb.h |    4 +---
>  lcr/lcr_ifact.c        |    4 +---
>  lib/sa-confdb.c        |    3 +--
>  5 files changed, 6 insertions(+), 16 deletions(-)
> 
> diff --git a/exec/coropoll.c b/exec/coropoll.c
> index 8a8aa81..fc94fac 100644
> --- a/exec/coropoll.c
> +++ b/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);
> 
> diff --git a/exec/main.c b/exec/main.c
> index 30933f5..473f507 100644
> --- a/exec/main.c
> +++ b/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) {
> diff --git a/include/corosync/hdb.h b/include/corosync/hdb.h
> index acca50c..8d8e2cc 100644
> --- a/include/corosync/hdb.h
> +++ b/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));
>  }
> diff --git a/lcr/lcr_ifact.c b/lcr/lcr_ifact.c
> index bcbc200..ce56de7 100644
> --- a/lcr/lcr_ifact.c
> +++ b/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;
> diff --git a/lib/sa-confdb.c b/lib/sa-confdb.c
> index ead48d0..61ac872 100644
> --- a/lib/sa-confdb.c
> +++ b/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;
>  }

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to