Add a missing NULL check before releasing a texture ref.

This causes a crash if the NV12 texture cache attempts to upload textures
for a frame with a NULL backing CVPixelBufferRef.

Bug: webrtc:10175
Change-Id: I6866dcde5ace745cbd95b762254294aa8406c2a5
Reviewed-on: https://webrtc-review.googlesource.com/c/115430
Commit-Queue: Chuck Hays <haysc@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26140}
This commit is contained in:
Aaron Golden
2019-01-04 12:03:31 -08:00
committed by Commit Bot
parent 47e38b73bb
commit fb4e9bc9a2
3 changed files with 59 additions and 2 deletions

View File

@ -60,8 +60,10 @@
kCFAllocatorDefault, _textureCache, pixelBuffer, NULL, GL_TEXTURE_2D, pixelFormat, width,
height, pixelFormat, GL_UNSIGNED_BYTE, planeIndex, textureOut);
if (ret != kCVReturnSuccess) {
CFRelease(*textureOut);
*textureOut = nil;
if (*textureOut) {
CFRelease(*textureOut);
*textureOut = nil;
}
return NO;
}
NSAssert(CVOpenGLESTextureGetTarget(*textureOut) == GL_TEXTURE_2D,