[libbluray-devel] check for realloc failures

hpi1 git at videolan.org
Wed Feb 26 09:09:15 CET 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Feb 23 14:03:05 2014 +0200| [97add35c391ef6514195d6597f2bd44eec06530b] | committer: hpi1

check for realloc failures

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=97add35c391ef6514195d6597f2bd44eec06530b
---

 src/util/refcnt.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/util/refcnt.c b/src/util/refcnt.c
index 405b253..785340f 100644
--- a/src/util/refcnt.c
+++ b/src/util/refcnt.c
@@ -99,8 +99,14 @@ void *refcnt_realloc(void *obj, size_t sz)
 
     if (obj) {
         obj = realloc(&((BD_REFCNT *)obj)[-1], sz);
+        if (!obj) {
+            return NULL;
+        }
     } else {
         obj = realloc(NULL, sz);
+        if (!obj) {
+            return NULL;
+        }
         memset(obj, 0, sizeof(BD_REFCNT));
     }
 



More information about the libbluray-devel mailing list