Re: add text to entry fails. g_snprintf bad?

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

 



You only need to reserve some memory for your labeltext1, use these lines:

gchar labeltext1[6];

g_snprintf(labeltext1, 6, "%f", sim.stepsize);

g_free(labeltext1);

That's it.

Quoting Sven Neumann <sven@xxxxxxxx>:

> Hi,
> 
> edward hage <edha@xxxxxxxxx> writes:
> 
> >     gchar *labeltext1;
> >
> >     g_snprintf(labeltext1, 6, "%f", sim.stepsize);
> >
> >     g_free(labeltext1);
> 
> I suggest you read the snprintf() manpage. You are using g_snprintf()
> on unallocated memory and later you even free the memory that has
> never before been allocated.
> 
> 
> Sven
> _______________________________________________
> 
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 
> 




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux