this avoids uninitialized values and potential misuse of them which
could lead to a crash should the function fail
this is the same fix that was applied in libaom:
d0cac70b5 Fix a free on invalid ptr when img allocation fails
Bug: webm:1722
Change-Id: If7a8d08c4b010f12e2e1d848613c0fa7328f1f9c
unsigned int stride_in_bytes;
int align;
+ if (img != NULL) memset(img, 0, sizeof(vpx_image_t));
+
/* Treat align==0 like align==1 */
if (!buf_align) buf_align = 1;
if (!img) goto fail;
img->self_allocd = 1;
- } else {
- memset(img, 0, sizeof(vpx_image_t));
}
img->img_data = img_data;