gnupic: Re: [gnupic] gpasm memory leaks
Subject:
Re: [gnupic] gpasm memory leaks
From:
"David Barnett" ####@####.####
Date:
31 May 2007 23:36:45 +0100
Message-Id: <013f01c7a3d3$8365c3e0$0301a8c0@barnett2>
A status update on the memory leaks for those interested: I've fixed a few
and rearranged a few of them. Two of them were just careless mistakes, but
several will take some serious rearranging, and for those I looked at today,
I just moved the responsibility for allocation up a stack frame or two
(closer to the frame that should be responsible for deallocation) and added
comments to point out those memory leaks. I know that sounds
confusing...basically I made the caller pass a pointer to allocated memory
down instead of the callee returning the allocated block. I had a real
headache when I finished with all the changes and learned that C doesn't
directly support pass-by-reference =(. To actually fix those leaks, I'll
need to do some more involved rearranging, but I'm trying to focus on one
change at a time so I don't forget something major. BTW, for those
experienced with fixing memory leaks in C, is the technique of passing a
reference/pointer down instead of returning one up a common fix? How does
that work for string and array functions where the callee determines the
length dynamically?
Also, it's been a while since I've used CVS, so I have a stupid question: Is
there an equivalent to "SVN diff -u" that will diff all files under version
control that changed in a directory or its subdirectories? I can only find
very roundabout ways of doing so, and it makes it very hard for me to keep
up with the changes I've made. I don't know how I used to manage without
SVN...
David Barnett
----- Original Message -----
From: "David Barnett" ####@####.####
To: ####@####.####
Sent: Tuesday, May 29, 2007 3:32 PM
Subject: [gnupic] gpasm memory leaks
I noticed some suspicious allocation code in gpasm, so I checked it with
valgrind. It seems to report several memory leaks in various places. I'll
look into them further as I have time. Did anyone already notice these? I
didn't see any bugs about memory leaks in the bug tracker...should I post
some?
David Barnett