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");