[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] Re: linebuffer.c bug

From: Simon Josefsson
Subject: [Bug-gnulib] Re: linebuffer.c bug
Date: Thu, 25 Sep 2003 01:24:51 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Paul Eggert <address@hidden> writes:

> Simon Josefsson <address@hidden> writes:
>> it may be good to document that readlinebuffer() never return
>> anything other than NULL or the input linebuffer parameter,
> That's already in the comment just before readlinebuffer, isn't it?

You are right, sorry.

>> Should the 'struct linebuffer *' be allocated by the application or by
>> linebuffer.c?  Right now the code free the pointer, but it never
>> allocate it, which seems like a bad idea.
> Yes, it's bogus.  I don't know of any program that uses freebuffer;
> coreutils simply invokes 'free' itself.  The least intrusive change is
> to change freebuffer to not free its argument; that will at worst
> cause a memory leak in the (nonexistent?) programs that use it.  So I
> installed this.  (Hmm, maybe freebuffer's argument should be const *
> now?  But I didn't do that.)

I happened to read linebuffer.c, and replaced fgets and a fixed-size
buffer in my code to use linebuffer instead, and then I used
freebuffer since it was there.  (Later I happened to read getline too,
which seems simpler, so I'll probably use that instead...)  Your patch
was what I have been using locally, so I'm happy with it, thanks.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]