comparison fifo.c @ 226:fb0c5c158c67 libavutil

better to set things to NULL instead of random in case of out of mem
author michael
date Wed, 17 Jan 2007 20:06:38 +0000
parents 0b93dab98397
children 158b400d2f75
comparison
equal deleted inserted replaced
225:0b93dab98397 226:fb0c5c158c67
22 #include "common.h" 22 #include "common.h"
23 #include "fifo.h" 23 #include "fifo.h"
24 24
25 int av_fifo_init(AVFifoBuffer *f, int size) 25 int av_fifo_init(AVFifoBuffer *f, int size)
26 { 26 {
27 f->wptr = f->rptr =
27 f->buffer = av_malloc(size); 28 f->buffer = av_malloc(size);
28 if (!f->buffer) 29 if (!f->buffer)
29 return -1; 30 return -1;
30 f->end = f->buffer + size; 31 f->end = f->buffer + size;
31 f->wptr = f->rptr = f->buffer;
32 return 0; 32 return 0;
33 } 33 }
34 34
35 void av_fifo_free(AVFifoBuffer *f) 35 void av_fifo_free(AVFifoBuffer *f)
36 { 36 {