diff --git a/src/data_transfer.cpp b/src/data_transfer.cpp
index b26bbb9f82a86e096242be67989a0fa060bd5308..fc1cfb4c51e6d1ca7da6d7f861e8dbd84e3faea2 100644
--- a/src/data_transfer.cpp
+++ b/src/data_transfer.cpp
@@ -343,7 +343,6 @@ TransferManager::transferFile(const std::shared_ptr<dhtnet::ChannelSocket>& chan
 bool
 TransferManager::cancel(const std::string& fileId)
 {
-    std::shared_ptr<dhtnet::ChannelSocket> channel;
     std::lock_guard<std::mutex> lk {pimpl_->mapMutex_};
     // Remove from waiting, this avoid auto-download
     auto itW = pimpl_->waitingIds_.find(fileId);