aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-11-07 10:55:25 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-11-11 10:03:48 +0100
commit0649433da53c7165f839e24e889e131e2894dd32 (patch)
tree7e516c1702fe87c09f190e5dc47ecd3a9bede1b8 /lib/ssh.c
parentcdfda3ee827da069f1871722278fd82e7cbb4194 (diff)
realloc: use Curl_saferealloc to avoid common mistakes
Discussed: https://curl.haxx.se/mail/lib-2016-11/0087.html
Diffstat (limited to 'lib/ssh.c')
-rw-r--r--lib/ssh.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index 0df030d27..420beb27e 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -71,7 +71,7 @@
#include "url.h"
#include "speedcheck.h"
#include "getinfo.h"
-
+#include "strdup.h"
#include "strcase.h"
#include "vtls/vtls.h"
#include "connect.h"
@@ -2112,9 +2112,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
/* get room for the filename and extra output */
sshc->readdir_totalLen += 4 + sshc->readdir_len;
- new_readdir_line = realloc(sshc->readdir_line, sshc->readdir_totalLen);
+ new_readdir_line = Curl_saferealloc(sshc->readdir_line,
+ sshc->readdir_totalLen);
if(!new_readdir_line) {
- Curl_safefree(sshc->readdir_line);
+ sshc->readdir_line = NULL;
Curl_safefree(sshc->readdir_filename);
Curl_safefree(sshc->readdir_longentry);
state(conn, SSH_SFTP_CLOSE);