diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-04-13 23:19:06 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-04-13 23:19:06 +0900 |
commit | d08b667172be0b6fdc3cdf7723205a7f5e12cfd4 (patch) | |
tree | c39d1c8d34712c8feb6711f3f5a65deed7e62db7 | |
parent | 0d2238b5a78bc1aa5440b0ce63f83249aafc40c2 (diff) | |
download | kasablanca-d08b667172be0b6fdc3cdf7723205a7f5e12cfd4.tar.gz kasablanca-d08b667172be0b6fdc3cdf7723205a7f5e12cfd4.zip |
Fixed cppcheck errors in ftplib.cpp. This solves #3.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r-- | src/ftplib.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ftplib.cpp b/src/ftplib.cpp index def17f9..94d5fff 100644 --- a/src/ftplib.cpp +++ b/src/ftplib.cpp @@ -756,6 +756,7 @@ int ftplib::FtpOpenPort(netbuf *nControl, netbuf **nData, int mode, int dir, cha { FtpClose(*nData); *nData = NULL; + free(ctrl); return -1; } @@ -851,9 +852,10 @@ int ftplib::FtpOpenPasv(netbuf *nControl, netbuf **nData, int mode, int dir, cha } if (nControl->dir != FTPLIB_CONTROL) return -1; - sprintf(cmd,"%s\r\n",cmd); - if (nControl->tlsctrl) ret = SSL_write(nControl->ssl,cmd,strlen(cmd)); - else ret = write(nControl->handle,cmd,strlen(cmd)); + char buf[256]; + sprintf(buf,"%s\r\n",cmd); + if (nControl->tlsctrl) ret = SSL_write(nControl->ssl,buf,strlen(buf)); + else ret = write(nControl->handle,buf,strlen(buf)); if (ret <= 0) { perror("write"); |