[SCM] kodi-pvr-vdr-vnsi/master: VNSISession: fix memory leak in Login()

tiber-guest at users.alioth.debian.org tiber-guest at users.alioth.debian.org
Sun Feb 28 15:46:49 UTC 2016


The following commit has been merged in the master branch:
commit a6be83461b93405ed2c39abac5c224dd72120751
Author: Max Kellermann <max at duempel.org>
Date:   Thu Nov 5 11:09:40 2015 +0100

    VNSISession: fix memory leak in Login()
    
    If an exception gets thrown, the "delete" is skipped.

diff --git a/src/VNSISession.cpp b/src/VNSISession.cpp
index 219a325..e988d4c 100644
--- a/src/VNSISession.cpp
+++ b/src/VNSISession.cpp
@@ -22,6 +22,8 @@
 #include "VNSISession.h"
 #include "client.h"
 
+#include <memory>
+
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/types.h>
@@ -115,7 +117,7 @@ bool cVNSISession::Login()
     }
 
     // read welcome
-    cResponsePacket* vresp = ReadResult(&vrp);
+    std::unique_ptr<cResponsePacket> vresp(ReadResult(&vrp));
     if (!vresp)
       throw "failed to read greeting from server";
 
@@ -135,8 +137,6 @@ bool cVNSISession::Login()
     if (m_name.empty())
       XBMC->Log(LOG_NOTICE, "Logged in at '%lu+%i' to '%s' Version: '%s' with protocol version '%d'",
         vdrTime, vdrTimeOffset, ServerName, ServerVersion, protocol);
-
-    delete vresp;
   }
   catch (const char * str)
   {

-- 
kodi-pvr-vdr-vnsi packaging



More information about the pkg-multimedia-commits mailing list