1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-29 01:03:57 +03:00

string: Fix memory leak in ssh_string_to_char().

This was probably a mistake by me fixing up a patch after merging.
This commit is contained in:
Andreas Schneider
2012-12-13 19:29:46 +01:00
parent b14df297fa
commit de9bc1fa41

View File

@@ -169,10 +169,10 @@ const char *ssh_string_get_char(struct ssh_string_struct *s)
char *ssh_string_to_char(struct ssh_string_struct *s) {
size_t len;
char *new;
if (s == NULL)
if (s == NULL) {
return NULL;
len = ssh_string_len(s) + 1;
new = malloc(len);
}
len = ssh_string_len(s);
if (len + 1 < len) {