RE: [PATCH 2/3] few logger fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: FUJITA Tomonori [mailto:fujita.tomonori@xxxxxxxxxxxxx]
Sent: Thu 6/3/2010 5:23 PM
 
On Thu, 03 Jun 2010 16:23:10 +0300
Alexander Nezhinsky <alexandern@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux