diff options
author | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2014-05-28 15:02:41 -0600 |
---|---|---|
committer | Zhao, Yakui <yakui.zhao@intel.com> | 2014-05-30 08:37:10 +0800 |
commit | fbbe401aa28a0b3859d587ef08f0df15a2f7c8f2 (patch) | |
tree | 33e3a65bb8ce51fc03e7f574474e957d898198d9 | |
parent | 60413182f66c44781456e827b439e98f21cfae4c (diff) |
Fix the segfault while encoding multiple slice per frame.
Zero initialize the packed raw data index array and
packed slice header index array during each preallocation.
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
-rwxr-xr-x | src/i965_drv_video.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index 5b51f44..fcbab79 100755 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -2467,6 +2467,7 @@ i965_encoder_render_picture(VADriverContextP ctx, * the packed data index/count for the slice */ if (encode->max_slice_params_ext > encode->slice_num) { + int slice_num = encode->slice_num; encode->slice_num = encode->max_slice_params_ext; encode->slice_rawdata_index = realloc(encode->slice_rawdata_index, encode->slice_num * sizeof(int)); @@ -2474,6 +2475,12 @@ i965_encoder_render_picture(VADriverContextP ctx, encode->slice_num * sizeof(int)); encode->slice_header_index = realloc(encode->slice_header_index, encode->slice_num * sizeof(int)); + memset(encode->slice_rawdata_index + slice_num, 0, + sizeof(int) * NUM_SLICES); + memset(encode->slice_rawdata_count + slice_num, 0, + sizeof(int) * NUM_SLICES); + memset(encode->slice_header_index + slice_num, 0, + sizeof(int) * NUM_SLICES); if ((encode->slice_rawdata_index == NULL) || (encode->slice_header_index == NULL) || (encode->slice_rawdata_count == NULL)) { |