diff --git a/xroot_plugins/XrdCtaStream.hpp b/xroot_plugins/XrdCtaStream.hpp
index 10bc82c3c087be8002082408b18ec8885fb82ee2..0e2639d54b8a5db789ed84cdbbfa4a086c6100b7 100644
--- a/xroot_plugins/XrdCtaStream.hpp
+++ b/xroot_plugins/XrdCtaStream.hpp
@@ -84,16 +84,19 @@ public:
       errMsg << __FUNCTION__ << " failed: Caught CTA exception: " << ex.what();
       eInfo.Set(errMsg.str().c_str(), ECANCELED);
       delete streambuf;
+      return nullptr;
     } catch(std::exception &ex) {
       std::ostringstream errMsg;
       errMsg << __FUNCTION__ << " failed: " << ex.what();
       eInfo.Set(errMsg.str().c_str(), ECANCELED);
       delete streambuf;
+      return nullptr;
     } catch(...) {
       std::ostringstream errMsg;
       errMsg << __FUNCTION__ << " failed: Caught an unknown exception";
       eInfo.Set(errMsg.str().c_str(), ECANCELED);
       delete streambuf;
+      return nullptr;
     }
     return streambuf;
   }