On 10/23/2015 01:43 PM, Peter Stuge wrote:
> Salvador,
>
> Salvador Fandino wrote:
>> I converted it into "_libssh2_error_flags" which accepts a flag
>> indicating whether the given string must be duplicated
>
> Please think about how and where allocated memory is being freed.
>
> Try creating and destroying sessions in a loop - there is a leak.
>
> Do you need to free this memory in other places besides that?
>
> Is there a LIBSSH2_REALLOC?
>
> Style: the function takes several parameters whose names start with err.
> You add a new parameter named flags, which does not start with err.
> Please be careful to always follow style wherever you make changes.
> Name the new parameter e.g. errflags.
Ok, lets try again:
Now "err_msg" is also freed from "session_free" when the DUP flag is set.
The "flags" argument to "_libssh2_error_flags" has been renamed to
"errflags".
Received on 2015-10-23