vp8e_mr_alloc_mem() leaks LOWER_RES_FRAME_INFO if second memory allocation fails
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2019 03:24:54 +0000 (03:24 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2019 03:24:54 +0000 (03:24 +0000)
commit054cf021970f1c3ecda9eb411e83cee53ee40434
treea8ac804d552c19c081654c28fa4b5ed2ec266e93
parent609c46e15fcc96f874383f7f246748b55ced255c
vp8e_mr_alloc_mem() leaks LOWER_RES_FRAME_INFO if second memory allocation fails
<https://webkit.org/b/194265>

Reviewed by Youenn Fablet.

* Source/third_party/libvpx/source/libvpx/vp8/vp8_cx_iface.c:
(vp8e_mr_alloc_mem):
- Initialize `res` to VPX_CODEC_OK instead of 0.
- Return early if first calloc() fails instead of trying the
  second calloc().  The function would crash dereferencing
  nullptr in `shared_mem_loc->mb_info` otherwise.
- Call free(shared_mem_loc) if the second call to calloc()
  fails.  This fixes the leak.
* WebKit/0003-libwebrtc-fix-vp8e_mr_alloc_mem-leak.diff: Add.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240961 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/ThirdParty/libwebrtc/ChangeLog
Source/ThirdParty/libwebrtc/Source/third_party/libvpx/source/libvpx/vp8/vp8_cx_iface.c
Source/ThirdParty/libwebrtc/WebKit/0003-libwebrtc-fix-vp8e_mr_alloc_mem-leak.diff [new file with mode: 0644]