[SCM] kodi-pvr-vdr-vnsi/master: requestpacket: throw std::bad_alloc on allocation failure

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


The following commit has been merged in the master branch:
commit 78e3c7268973d2fece80011996bea6dd28f15ebc
Author: Max Kellermann <max at duempel.org>
Date:   Sat Nov 7 23:01:57 2015 +0100

    requestpacket: throw std::bad_alloc on allocation failure
    
    Simplify error handling in callers.

diff --git a/src/requestpacket.cpp b/src/requestpacket.cpp
index d37ded8..d618ecf 100644
--- a/src/requestpacket.cpp
+++ b/src/requestpacket.cpp
@@ -61,7 +61,7 @@ bool cRequestPacket::init(uint32_t topcode, bool stream, bool setUserDataLength,
   }
 
   buffer = (uint8_t*)malloc(bufSize);
-  if (!buffer) return false;
+  if (!buffer) throw std::bad_alloc();
 
   if (!stream)
     channel     = VNSI_CHANNEL_REQUEST_RESPONSE;
@@ -176,7 +176,7 @@ bool cRequestPacket::checkExtend(size_t by)
   {
     newBuf = (uint8_t*)malloc(bufUsed + by);
     if (!newBuf) {
-      return false;
+      throw std::bad_alloc();
     }
     memcpy(newBuf, buffer, bufUsed);
     free(buffer);

-- 
kodi-pvr-vdr-vnsi packaging



More information about the pkg-multimedia-commits mailing list