Hi Al,

On 16:54 Fri 07 Dec     , Al Chu wrote:
> Hey Sasha,
> 
> Nothing fancy.  Just noticed the check is done in the ftree equivalent
> destroy function so I figured it should be in the others.

Is it possible/legal usage to have context = NULL in those desctructors?
If not, I don't think we need such checks.

Sasha

> 
> Al
> 
> -- 
> Albert Chu
> [EMAIL PROTECTED]
> 925-422-5311
> Computer Scientist
> High Performance Systems Division
> Lawrence Livermore National Laboratory

> From c94361165ab2a3c6e8dadb6596d97d79e36bb1f6 Mon Sep 17 00:00:00 2001
> From: Albert L. Chu <[EMAIL PROTECTED]>
> Date: Fri, 7 Dec 2007 13:43:15 -0800
> Subject: [PATCH] add null check in context destroy functions
> 
> 
> Signed-off-by: Albert L. Chu <[EMAIL PROTECTED]>
> ---
>  opensm/opensm/osm_ucast_lash.c |    2 ++
>  opensm/opensm/osm_ucast_updn.c |    3 +++
>  2 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/opensm/opensm/osm_ucast_lash.c b/opensm/opensm/osm_ucast_lash.c
> index 5e7716e..bdcd2d1 100644
> --- a/opensm/opensm/osm_ucast_lash.c
> +++ b/opensm/opensm/osm_ucast_lash.c
> @@ -1469,6 +1469,8 @@ static lash_t *lash_create(osm_opensm_t * p_osm)
>  static void lash_delete(void *context)
>  {
>       lash_t *p_lash = context;
> +        if (!context)
> +                return;
>       if (p_lash->switches) {
>               unsigned id;
>               for (id = 0; ((int)id) < p_lash->num_switches; id++)
> diff --git a/opensm/opensm/osm_ucast_updn.c b/opensm/opensm/osm_ucast_updn.c
> index 0b7b1a9..24c9fe3 100644
> --- a/opensm/opensm/osm_ucast_updn.c
> +++ b/opensm/opensm/osm_ucast_updn.c
> @@ -234,6 +234,9 @@ static void updn_destroy(IN updn_t * const p_updn)
>  {
>       uint64_t *p_guid_list_item;
>  
> +        if (!p_updn)
> +                return;
> +
>       /* free the array of guids */
>       if (p_updn->updn_ucast_reg_inputs.guid_list)
>               free(p_updn->updn_ucast_reg_inputs.guid_list);
> -- 
> 1.5.1
> 

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to