List Info

Thread: r232 - trunk/libnut/demuxer.c




r232 - trunk/libnut/demuxer.c
user name
2006-11-18 11:04:41
Author: ods15
Date: Sat Nov 18 12:04:40 2006
New Revision: 232

Modified:
   trunk/libnut/demuxer.c

Log:
if a memory error occured in input buffer allocation, make
sure it is forwarded up


Modified: trunk/libnut/demuxer.c
============================================================
==================
--- trunk/libnut/demuxer.c	(original)
+++ trunk/libnut/demuxer.c	Sat Nov 18 12:04:40 2006
 -28,10
+28,11 
 	int pos = (bc->buf_ptr - bc->buf);
 	if (bc->read_len - pos < amount &&
!bc->is_mem) {
 		amount += 10; // ### + PREALLOC_SIZE ?
+		if (!bc->alloc) return 0; // there was a previous
memory error
 		if (bc->write_len - pos < amount) {
 			int new_len = amount + pos + PREALLOC_SIZE;
 			uint8_t * buf = bc->alloc->realloc(bc->buf,
new_len);
-			if (!buf) return 0;
+			if (!buf) { bc->alloc = NULL; return 0; }
 			bc->write_len = new_len;
 			bc->buf = buf;
 			bc->buf_ptr = bc->buf + pos;
 -67,6
+68,7 
 
 static int buf_eof(input_buffer_t * bc) {
 	if (bc->is_mem) return NUT_ERR_BAD_EOF;
+	if (!bc->alloc) return NUT_ERR_OUT_OF_MEM;
 	if (!bc->isc.eof || bc->isc.eof(bc->isc.priv))
return NUT_ERR_EOF;
 	return NUT_ERR_EAGAIN;
 }
_______________________________________________
NUT-devel mailing list
NUT-develmplayerhq.hu

http://lists.mplayerhq.hu/mailman/listinfo/nut-devel
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )