Re: canvas item color
- From: Matthew Kirkwood <weejock ferret lmh ox ac uk>
- To: Todd Graham Lewis <tlewis mindspring net>
- cc: Federico Mena Quintero <federico nuclecu unam mx>, gnome-list gnome org
- Subject: Re: canvas item color
- Date: Fri, 8 Jan 1999 17:45:40 +0000 (GMT)
On Fri, 8 Jan 1999, Todd Graham Lewis wrote:
> > char *
> > get_color_spec (int r, int g, int b)
> > {
> > static char spec[50];
> >
> > sprintf (spec, "#%04x%04x%04x", r, g, b);
> > return spec;
> > }
> Question from Todd, the notoriously bad C programmer:
>
> Isn't this a memory leak? Shouldn't the caller be responsible for
> allocating spec[] and passing it in?
Not a memory leak (the spec[] array is static), but somewhat dangerous in
other ways (threads, re-entrancy, &c).
Matthew.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]