diff options
| author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-14 18:30:19 +0200 |
|---|---|---|
| committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-14 18:30:19 +0200 |
| commit | cb2dc09164a533fc544c59469f6f8bd7d1cc5e04 (patch) | |
| tree | b6681a749f382c15f1c84f554961a9c64bd13742 /src/video_out | |
| parent | a99bea5eb67de57de5aa3259b5b5432d4aaa9c1a (diff) | |
| download | xine-lib-cb2dc09164a533fc544c59469f6f8bd7d1cc5e04.tar.gz xine-lib-cb2dc09164a533fc544c59469f6f8bd7d1cc5e04.tar.bz2 | |
Use xine_xcalloc instead of xine_xmalloc when mutiplying the number of elements by the size of the single element.
(transplanted from 512894f517c423fed0cadeca0d46c6d909403106)
--HG--
extra : transplant_source : Q%28%94%F5%17%C4%23%FE%D0%CA%DE%CA%0DF%C6%D9%09%401%06
Diffstat (limited to 'src/video_out')
| -rw-r--r-- | src/video_out/video_out_fb.c | 26 | ||||
| -rw-r--r-- | src/video_out/video_out_xshm.c | 2 |
2 files changed, 8 insertions, 20 deletions
diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 95060a4d8..de5aa5d8d 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -324,21 +324,10 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags) static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, uint32_t width, uint32_t height, int format) { - if(frame->chunk[0]) - { - free(frame->chunk[0]); - frame->chunk[0] = NULL; - } - if(frame->chunk[1]) - { - free(frame->chunk[1]); - frame->chunk[1] = NULL; - } - if(frame->chunk[2]) - { - free(frame->chunk[2]); - frame->chunk[2] = NULL; - } + free(frame->chunk[0]); + free(frame->chunk[1]); + free(frame->chunk[2]); + memset(frame->chunk, 0, sizeof(frame->chunk[0])*3); if(this->use_zero_copy) { @@ -348,10 +337,9 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, } else { - if(frame->data) - free(frame->data); - frame->data = xine_xmalloc(frame->sc.output_width * - frame->sc.output_height * + free(frame->data); + frame->data = xine_xcalloc(frame->sc.output_width * + frame->sc.output_height, this->bytes_per_pixel); } diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 9e901821a..e9898d6d0 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -276,7 +276,7 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, this->bytes_per_pixel = this->bpp / 8; this->image_byte_order = myimage->byte_order; - myimage->data = xine_xmalloc (width * this->bytes_per_pixel * height); + myimage->data = xine_xcalloc (width * height, this->bytes_per_pixel); } return myimage; |
