bug-ed
[Top][All Lists]
Advanced

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

[Bug-ed] Memory and ressource leak in ed


From: Cédric Picard
Subject: [Bug-ed] Memory and ressource leak in ed
Date: Fri, 17 Jul 2015 22:55:43 +0200
User-agent: Mutt/1.5.23+102 (2ca89bed6448) (2014-03-12)

Hi,

I did a static analysis of ed 1.12 with cppcheck and found 3 issues:

    [buffer.c:447]: (error) Memory leak: lp
    [io.c:264]: (error) Resource leak: fp
    [io.c:322]: (error) Resource leak: fp

The two ressource leaks were a file not closed on error.
The memory leak is a line node allocated but not freed on error in
put_sbuf_line. I'll admit that as global variables are involved, I'm
not completely sure that it is a memory leak, but it sure looks like
so.

You will find with this mail two patches that seem to correct the
problems. Once applied, cppcheck doesn't complain anymore and all
tests pass.

Honestly, I can't see how those bugs could become problematic in any
realistic way but bugs are meant to be fixed, aren't they?

Regards,

Cédric Picard

PS: as this is my first contribution to a GNU project, feel free to
tell me if I can improve anything.

Attachment: buffer.diff
Description: Text document

Attachment: io.diff
Description: Text document


reply via email to

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