[PATCH] Add a subject indicating that the commit message is empty
git at nezmer.info
Thu Aug 11 02:57:32 CEST 2011
> > > + 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.
> This should be implemented slightly differently.
> The idea sounds good, though. I'll have a look at that.
Would declaring a const char* in cgit.h and pointing all empty subjects
to it be a good choice?
> > > + ret->subject = xstrdup("(no commit message)");
> > > + }
More information about the CGit