Re: [gdm-list] [PATCH] fix gcc warnings



Frederic Crozat wrote:
> Le mardi 30 janvier 2007 à 16:25 +0100, Ludwig Nussel a écrit :
> > Index: gdm2/daemon/errorgui.c
> > ===================================================================
> > --- gdm2.orig/daemon/errorgui.c
> > +++ gdm2/daemon/errorgui.c
> > @@ -317,12 +317,10 @@ gdm_error_box_full (GdmDisplay *d, GtkMe
> >  
> >  		if (details_label != NULL) {
> >   			if (strncmp (details_label, "NIL", 3) == 0)
> > -				g_free (details_label);
> >  				details_label = NULL;
> >  		}
> >  		if (details_file != NULL) {
> >  			if (strncmp (details_file, "NIL", 3) == 0)
> > -				g_free (details_file);
> >  				details_file = NULL;
> >  		}
> 
> This fix looks incomplete, since details_file is const char *, you
> should be able to assign a NULL value.

You can assign NULL but you cannot free the pointer's content:

const char* foo;
char* const bar;

foo = NULL; // ok
bar = NULL; // wrong

free(foo);  // wrong
free(bar);  // ok

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/




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