On Thu, Aug 11, 2011 at 03:57:32AM +0300, Nezmer wrote: > > > > + ret->subject = xmalloc(20); > > > > > > xstrdup already allocates memory. No need to invoke malloc here (doing > > > this will result in a memory leak). > > Good to know. > > > > > Oh, and you obviously also introduce a memory leak by overwriting the > > pointer stored in "ret->subject" before without free'ing it. > > I assumed strchr(p, '\n') would return NULL here. I see that my > assumption was wrong now.
It does. Notice the else branch though. > > > This should be implemented slightly differently. > > The idea sounds good, though. I'll have a look at that. > > Thanks. > > Would declaring a const char* in cgit.h and pointing all empty subjects > to it be a good choice? No. If you do that, cgit will crash when trying to free the subject string in cgit_free_commitinfo(). _______________________________________________ cgit mailing list [email protected] http://hjemli.net/mailman/listinfo/cgit
