
Author: ods15 Date: Sat Sep 23 22:02:03 2006 New Revision: 148 Modified: trunk/libnut/demuxer.c Log: some more malloc checks Modified: trunk/libnut/demuxer.c ============================================================================== --- trunk/libnut/demuxer.c (original) +++ trunk/libnut/demuxer.c Sat Sep 23 22:02:03 2006 @@ -84,6 +84,7 @@ } static input_buffer_t * new_mem_buffer(input_buffer_t * bc) { + if (!bc) return NULL; bc->read_len = 0; bc->write_len = 0; bc->is_mem = 1; @@ -96,6 +97,7 @@ static input_buffer_t * new_input_buffer(nut_alloc_t * alloc, nut_input_stream_t isc) { input_buffer_t * bc = new_mem_buffer(alloc->malloc(sizeof(input_buffer_t))); + if (!bc) return NULL; bc->alloc = alloc; bc->is_mem = 0; bc->isc = isc; @@ -1261,6 +1263,8 @@ if (dopts->alloc.malloc) nut = dopts->alloc.malloc(sizeof(nut_context_t)); else nut = malloc(sizeof(nut_context_t)); + if (!nut) return NULL; + nut->syncpoints.len = 0; nut->syncpoints.alloc_len = 0; nut->syncpoints.s = NULL; @@ -1287,6 +1291,11 @@ nut->i = new_input_buffer(nut->alloc, dopts->input); + if (!nut->i) { + nut->alloc->free(nut); + return NULL; + } + return nut; }
participants (1)
-
ods15