From de9bc1fa41155f30257b73a8bc8b55ce496fbb62 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 13 Dec 2012 19:29:46 +0100 Subject: [PATCH] string: Fix memory leak in ssh_string_to_char(). This was probably a mistake by me fixing up a patch after merging. --- src/string.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/string.c b/src/string.c index acaa41af..5ef90b0e 100644 --- a/src/string.c +++ b/src/string.c @@ -167,12 +167,12 @@ const char *ssh_string_get_char(struct ssh_string_struct *s) * string may not be readable with regular libc functions. */ char *ssh_string_to_char(struct ssh_string_struct *s) { - size_t len; - char *new; - if (s == NULL) - return NULL; - len = ssh_string_len(s) + 1; - new = malloc(len); + size_t len; + char *new; + + if (s == NULL) { + return NULL; + } len = ssh_string_len(s); if (len + 1 < len) {