libbluray | branch: master | hpi1 <[email protected]> | 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));
     }
 

_______________________________________________
libbluray-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/libbluray-devel

Reply via email to