string: Fix memory leak in ssh_string_to_char().
This was probably a mistake by me fixing up a patch after merging.
Этот коммит содержится в:
родитель
b14df297fa
Коммит
de9bc1fa41
12
src/string.c
12
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.
|
* string may not be readable with regular libc functions.
|
||||||
*/
|
*/
|
||||||
char *ssh_string_to_char(struct ssh_string_struct *s) {
|
char *ssh_string_to_char(struct ssh_string_struct *s) {
|
||||||
size_t len;
|
size_t len;
|
||||||
char *new;
|
char *new;
|
||||||
if (s == NULL)
|
|
||||||
return NULL;
|
if (s == NULL) {
|
||||||
len = ssh_string_len(s) + 1;
|
return NULL;
|
||||||
new = malloc(len);
|
}
|
||||||
|
|
||||||
len = ssh_string_len(s);
|
len = ssh_string_len(s);
|
||||||
if (len + 1 < len) {
|
if (len + 1 < len) {
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user