On Mon, Nov 24, 2014 at 08:37:47PM +0100, Nicolas Bedos wrote:
> In locate.code.c 'mbuf' is never free()d: it is only allocated for the
> last line of input and after processing this line the program ends. I
> hope it is ok.

I would free() it nontheless outside the while loop.  For the sake of
faster review.  But that's just my opinion.

Also, it would be nice if there is only one len/sizeof() check after
fgetln.  Which means that the check should be done after the
if/else-block.  Could happen that we malloc memory for nothing, but hey:
It happens only once and just if there is a missing newline.

And while at it, silently ignoring lines doesn't sound like a good idea.
I would even go for an err() call; or at least warn().


Tobias

Reply via email to