On Mon, Jan 03, 2005 at 12:14:31PM +0000, Neil Williams wrote: > Lines 129+130 in qofbackend.c are confusing me: > > 129 if (be->error_msg) g_free (be->error_msg); > 130 be->error_msg = NULL; > > I'm getting a segmentation fault because error_msg exists but is out of > bounds. Why would it exist before g_new had finished? Why is it checked? > Wouldn't any uninitialised value be out of range?
g_new doesn't zero memory, g_new0 does. Uninitialized variables may by out of range, or may not be. So, as defined, qof_backend_init, must not be called like: b = g_new(...); qof_backend_init(b); That _will_ SEGV depending on unititialized b->error_msg value. -chris _______________________________________________ gnucash-devel mailing list [email protected] https://lists.gnucash.org/mailman/listinfo/gnucash-devel
