Thread (1 message) 1 message, 1 author, 2008-09-23

Re: [patch] tsearch.3: dispose properly of allocated resources in example code

From: André Goddard Rosa <hidden>
Date: 2008-09-23 13:23:51

Possibly related (same subject, not in this thread)

On Tue, Sep 23, 2008 at 3:28 AM, Michael Kerrisk
[off-list ref] wrote:
André,

On Sun, Sep 21, 2008 at 8:10 AM, André Goddard Rosa
[off-list ref] wrote:
quoted
As there are many users who base their own code on these examples, we
should avoid leaking memory when using functions of tsearch() family.
In the provided example, tsearch() leaks memory whenever it tries to
insert a number which was already inserted before.
Thanks.  My first patch applied via 'git am'!

I applied this patch for man-pages-3.10.  (I added
#define _GNU_SOURCE
since that's required to expose the tdestroy() declaration.)
Hi, Michael!

    Very nice, thank you! Good to know that you're using git.

    I appreciate your work in the man pages, they were improved a lot
since you've started working on them. Also, I appreciate your concerns
regarding paccept().

    Notice that I sent two different patches in a sequence (sorry for that).

This is the first one:
+        else if (!((*(int **) val) == ptr))
and this is the second one:

+        else if ((*(int **) val) != ptr)

    They work the same, but second is cleaner and simpler ;-)

Kind regards,
-- 
[]s,
André Goddard
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help