[stgt] [PATCH 2/3] few logger fixes

Alexander Nezhinsky alexandern at voltaire.com
Thu Jun 3 23:31:07 CEST 2010


-----Original Message-----
From: FUJITA Tomonori [mailto:fujita.tomonori at lab.ntt.co.jp]
Sent: Thu 6/3/2010 5:23 PM
 
On Thu, 03 Jun 2010 16:23:10 +0300
Alexander Nezhinsky <alexandern at Voltaire.COM> wrote:

> added initialization and safety checks for the logarea pointer
> 
> -static struct logarea *la;
> +static struct logarea *la = NULL;

> Hmm, guaranteed to be initialized.

>  static void free_logarea (void)
>  {
> +	if (!la)
> +		return;
>  	semctl(la->semid, 0, IPC_RMID, la->semarg);
>  	shmdt(la->buff);
>  	shmdt(la->start);
>  	shmdt(la);
> +	la = NULL;
>  }

Ok, sure. Initialization added mainly for expressiveness.
My point was mainly in adding checks and resetting to NULL upon free.
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list