From 5cc439c2c24859accf8a94d8a91879ad6d967ea4 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 24 Aug 2010 13:07:44 +0200 Subject: concat_path_file: make it a C function, not C++ Signed-off-by: Denys Vlasenko --- lib/plugins/FileTransfer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/plugins/FileTransfer.cpp') diff --git a/lib/plugins/FileTransfer.cpp b/lib/plugins/FileTransfer.cpp index cf7cf1f3..05820d05 100644 --- a/lib/plugins/FileTransfer.cpp +++ b/lib/plugins/FileTransfer.cpp @@ -55,7 +55,7 @@ void CFileTransfer::SendFile(const char *pURL, const char *pFilename) update_client(_("Sending archive %s to %s"), pFilename, pURL); - string wholeURL = concat_path_file(pURL, strrchr(pFilename, '/') ? : pFilename); + char *whole_url = concat_path_file(pURL, strrchr(pFilename, '/') ? : pFilename); int count = m_nRetryCount; while (1) @@ -63,6 +63,7 @@ void CFileTransfer::SendFile(const char *pURL, const char *pFilename) FILE *f = fopen(pFilename, "r"); if (!f) { + free(whole_url); throw CABRTException(EXCEP_PLUGIN, "Can't open archive file '%s'", pFilename); } @@ -73,7 +74,7 @@ void CFileTransfer::SendFile(const char *pURL, const char *pFilename) /* enable uploading */ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); /* specify target */ - curl_easy_setopt(curl, CURLOPT_URL, wholeURL.c_str()); + curl_easy_setopt(curl, CURLOPT_URL, whole_url); /* FILE handle: passed to the default callback, it will fread() it */ curl_easy_setopt(curl, CURLOPT_READDATA, f); curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)buf.st_size); @@ -88,6 +89,7 @@ void CFileTransfer::SendFile(const char *pURL, const char *pFilename) /* retry the upload if not succesful, wait a bit before next try */ sleep(m_nRetryDelay); } + free(whole_url); } static void create_tar(const char *archive_name, const char *directory) -- cgit