From fbf7cd527922a5bc75498ffa12bb80aaa72b1f3d Mon Sep 17 00:00:00 2001 From: Elvin Sindrilaru Date: Fri, 12 Dec 2014 12:15:43 +0100 Subject: [PATCH] XrdCl: Delete URL pointer if it was previously allocated to avoid leak in case the same file object is used in a loop to open and close files. --- src/XrdCl/XrdClFileStateHandler.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/XrdCl/XrdClFileStateHandler.cc b/src/XrdCl/XrdClFileStateHandler.cc index 0a9244cde28..8f97f51e8c5 100644 --- a/src/XrdCl/XrdClFileStateHandler.cc +++ b/src/XrdCl/XrdClFileStateHandler.cc @@ -305,6 +305,13 @@ namespace XrdCl // Check if the parameters are valid //-------------------------------------------------------------------------- Log *log = DefaultEnv::GetLog(); + + if (pFileUrl) + { + delete pFileUrl; + pFileUrl = 0; + } + pFileUrl = new URL( url ); if( !pFileUrl->IsValid() ) {