[Gnucash-changes] r13894 - gnucash/trunk - Bug#340358: mem/string-handling crasher fix.

Josh Sled jsled at asynchronous.org
Tue May 2 08:20:26 EDT 2006


On Mon, 2006-05-01 at 21:45 -0400, Derek Atkins wrote:
> Quoting Joshua Sled <jsled at cvs.gnucash.org>:
> >     /* length in bytes, not chars. do not use g_utf8_strlen. */
> > -    buf = malloc(strlen(bcell->value));
> > +    buf = malloc(strlen(bcell->value)+1);
> > +    memset(buf, 0, strlen(bcell->value)+1);
> >     g_utf8_strncpy(buf, bcell->value, start);
> >     g_string_append(newval_gs, buf);
> >     g_free(buf);
> 
> Umm, this is problematic -- malloc() and then g_free()???  We should
> use either malloc()/free(), or g_malloc()/g_free()...

I've changed it to `free`.

-- 
...jsled
http://asynchronous.org/ - `a=jsled; b=asynchronous.org; echo ${a}@${b}`


More information about the gnucash-devel mailing list