Hi Daniel,
I'm glad this help.
Now, maybe you better understand why my code allocated a 7 bytes buffer to store the method: just because the method is freed later in userauth_hostbased_fromfile / userauth_publickey_fromfile ...
Maybe a better solution could be to always assume/impose that methods be constant static storage everywhere in libssh2. In that case, there would be no need to deal with alloc/free aspect for methods ...
I think it's possible since after all, methods are strings like ssh-rsa, ssh-dss, ... which are fixed length strings.
JL
-----Message d'origine-----
De : Daniel Stenberg [mailto:daniel_at_haxx.se]
Envoyé : samedi 28 mars 2009 22:33
À : libssh2 development
Objet : Re: About allocation/desallocation
On Sat, 28 Mar 2009, Jean-Louis CHARTON wrote:
> => Here, notice that on failure, session->userauth_host_method is freed.
> Also notice that in userauth_hostbased_fromfile, there is no call to
> free pubkeydata.
> So I believe there is a memory leak in userauth_hostbased_fromfile.
>
> Am I right or is there something I've missed?
I'd say you're entirely right! I've committed a fix for this just now. Thanks
a lot for your great catch!
-- / daniel.haxx.se ------------------------------------------------------------------------------ _______________________________________________ libssh2-devel mailing list libssh2-devel_at_lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel ------------------------------------------------------------------------------ _______________________________________________ libssh2-devel mailing list libssh2-devel_at_lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-develReceived on 2009-03-28