skiplist insert free?
Thomas Guyot-Sionnest
dermoth at aei.ca
Tue Sep 30 06:27:27 CEST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 29/09/08 03:26 AM, hiren wrote:
> thanks.
> I'm a bit confused about why it could be correct though, from what I see
> the function uses "update" and frees it at the end just before returning
> anyway. from what I understand the function uses "update" only for
> itself either way?
>
> On Sun, 2008-09-28 at 16:54 +0200, Andreas Ericsson wrote:
>> hirenp wrote:
>>> Hi,
>>>
>>> I'm wondering if this is a valid submission:
>>>
>> I'll look into it. If the skiplist api copies the passed data,
>> then it's correct (as the caller will never have a pointer to
>> the data in that case). If the api doesn't, then it's wrong,
>> as the caller may need to do something else with the pointer
>> when the skiplist insertion fails.
This looks valid... update is malloc'ed and initialized with NULLs right
above the diff chunk... It seems like a temporary buffer and is freed at
all other places.
Even better would be placing this check before the malloc as there's no
need to malloc it there if we're going to return. You can pull my
*absolutely untested* patch here...
http://solaris.beaubien.net/cgi-bin/gitweb.cgi/nagios.git/
- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFI4aqv6dZ+Kt5BchYRAhoGAKDxN2V1osbD+wRILcws1N7VwZ9DHgCcD0lO
0D7k/e/bHpinDn+VqeK5hew=
=s/BO
-----END PGP SIGNATURE-----
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
More information about the Developers
mailing list