Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: libavcodec/vp3.c

Issue 9373002: Fix valgrind and asan memory leaks and crashes. (Closed) Base URL: ssh://gerrit.chromium.org:29418/chromium/third_party/ffmpeg.git@master
Patch Set: Notes. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003-2004 the ffmpeg project 2 * Copyright (C) 2003-2004 the ffmpeg project
3 * 3 *
4 * This file is part of FFmpeg. 4 * This file is part of FFmpeg.
5 * 5 *
6 * FFmpeg is free software; you can redistribute it and/or 6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public 7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version. 9 * version 2.1 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 { 1623 {
1624 Vp3DecodeContext *s = avctx->priv_data; 1624 Vp3DecodeContext *s = avctx->priv_data;
1625 int y_fragment_count, c_fragment_count; 1625 int y_fragment_count, c_fragment_count;
1626 1626
1627 y_fragment_count = s->fragment_width[0] * s->fragment_height[0]; 1627 y_fragment_count = s->fragment_width[0] * s->fragment_height[0];
1628 c_fragment_count = s->fragment_width[1] * s->fragment_height[1]; 1628 c_fragment_count = s->fragment_width[1] * s->fragment_height[1];
1629 1629
1630 s->superblock_coding = av_malloc(s->superblock_count); 1630 s->superblock_coding = av_malloc(s->superblock_count);
1631 s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment)); 1631 s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment));
1632 s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int)); 1632 s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int));
1633 s->dct_tokens_base = av_malloc(64*s->fragment_count * sizeof(*s->dct_tokens_ base)); 1633 s->dct_tokens_base = av_mallocz(64*s->fragment_count * sizeof(*s->dct_tokens _base));
1634 s->motion_val[0] = av_malloc(y_fragment_count * sizeof(*s->motion_val[0])); 1634 s->motion_val[0] = av_malloc(y_fragment_count * sizeof(*s->motion_val[0]));
1635 s->motion_val[1] = av_malloc(c_fragment_count * sizeof(*s->motion_val[1])); 1635 s->motion_val[1] = av_malloc(c_fragment_count * sizeof(*s->motion_val[1]));
1636 1636
1637 /* work out the block mapping tables */ 1637 /* work out the block mapping tables */
1638 s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int)); 1638 s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int));
1639 s->macroblock_coding = av_malloc(s->macroblock_count + 1); 1639 s->macroblock_coding = av_malloc(s->macroblock_count + 1);
1640 1640
1641 if (!s->superblock_coding || !s->all_fragments || !s->dct_tokens_base || 1641 if (!s->superblock_coding || !s->all_fragments || !s->dct_tokens_base ||
1642 !s->coded_fragment_list[0] || !s->superblock_fragments || !s->macroblock _coding || 1642 !s->coded_fragment_list[0] || !s->superblock_fragments || !s->macroblock _coding ||
1643 !s->motion_val[0] || !s->motion_val[1]) { 1643 !s->motion_val[0] || !s->motion_val[1]) {
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 .priv_data_size = sizeof(Vp3DecodeContext), 2391 .priv_data_size = sizeof(Vp3DecodeContext),
2392 .init = vp3_decode_init, 2392 .init = vp3_decode_init,
2393 .close = vp3_decode_end, 2393 .close = vp3_decode_end,
2394 .decode = vp3_decode_frame, 2394 .decode = vp3_decode_frame,
2395 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAM E_THREADS, 2395 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAM E_THREADS,
2396 .flush = vp3_decode_flush, 2396 .flush = vp3_decode_flush,
2397 .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"), 2397 .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
2398 .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy), 2398 .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy),
2399 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) 2399 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context)
2400 }; 2400 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698