jpegyuv: fix memory leak when @image_buffer allocation fails
Make sure @yuv_buffer is freed before return.
This commit is contained in:
@@ -112,6 +112,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
image_buffer = malloc(frame_width*16 + 2*(frame_width/2)*8);
|
image_buffer = malloc(frame_width*16 + 2*(frame_width/2)*8);
|
||||||
if (!image_buffer) {
|
if (!image_buffer) {
|
||||||
|
free(yuv_buffer);
|
||||||
fprintf(stderr, "Memory allocation failure!\n");
|
fprintf(stderr, "Memory allocation failure!\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user