Mailing List Archive

[PATCH] Fix for memory leak allocated through buf in do_convert_from_ssh2() API.
Signed-off-by: krishnaiah bommu <krishnaiah.bommu@intel.com>
---
ssh-keygen.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/ssh-keygen.c b/ssh-keygen.c
index 8c829ca..61ad92a 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -651,6 +651,7 @@ do_convert_from_ssh2(struct passwd *pw, struct sshkey **k, int *private)
*k = do_convert_private_ssh2(buf);
else if ((r = sshkey_fromb(buf, k)) != 0)
fatal("decode blob failed: %s", ssh_err(r));
+ free(buf);
fclose(fp);
}

--
2.7.4

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: [PATCH] Fix for memory leak allocated through buf in do_convert_from_ssh2() API. [ In reply to ]
This should be a sshbuf_free() rather than free(); I've committed the former.

On Fri, 11 Oct 2019, krishnaiah bommu wrote:

> Signed-off-by: krishnaiah bommu <krishnaiah.bommu@intel.com>
> ---
> ssh-keygen.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/ssh-keygen.c b/ssh-keygen.c
> index 8c829ca..61ad92a 100644
> --- a/ssh-keygen.c
> +++ b/ssh-keygen.c
> @@ -651,6 +651,7 @@ do_convert_from_ssh2(struct passwd *pw, struct sshkey **k, int *private)
> *k = do_convert_private_ssh2(buf);
> else if ((r = sshkey_fromb(buf, k)) != 0)
> fatal("decode blob failed: %s", ssh_err(r));
> + free(buf);
> fclose(fp);
> }
>
> --
> 2.7.4
>
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev@mindrot.org
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
>
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev