[libdvdnav-devel] dvdnav_read_cache_new: invert a condition

Jean-Baptiste Kempf git at videolan.org
Thu Jul 31 02:02:04 CEST 2014


libdvdnav | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Jul 31 01:57:44 2014 +0200| [a240ff07f28178749dd056cec8efe50780f9cb7e] | committer: Jean-Baptiste Kempf

dvdnav_read_cache_new: invert a condition

> http://git.videolan.org/gitweb.cgi/libdvdnav.git/?a=commit;h=a240ff07f28178749dd056cec8efe50780f9cb7e
---

 src/read_cache.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/read_cache.c b/src/read_cache.c
index 23f94e7..d0056c5 100644
--- a/src/read_cache.c
+++ b/src/read_cache.c
@@ -102,7 +102,9 @@ read_cache_t *dvdnav_read_cache_new(dvdnav_t* dvd_self) {
 
   self = (read_cache_t *)malloc(sizeof(read_cache_t));
 
-  if(self) {
+  if(!self)
+    return NULL;
+
     self->current = 0;
     self->freeing = 0;
     self->dvd_self = dvd_self;
@@ -115,7 +117,6 @@ read_cache_t *dvdnav_read_cache_new(dvdnav_t* dvd_self) {
       self->chunk[i].cache_buffer = NULL;
       self->chunk[i].usage_count = 0;
     }
-  }
 
   return self;
 }



More information about the libdvdnav-devel mailing list