Fix few more issues detected in MozJPEG wrapper

This commit is contained in:
Ingvar Stepanyan
2020-07-17 02:23:00 +01:00
committed by Ingvar Stepanyan
parent 93cbe557cd
commit 39e5741cb2

View File

@@ -103,8 +103,8 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
// fprintf(stderr, "can't open %s\n", filename); // fprintf(stderr, "can't open %s\n", filename);
// exit(1); // exit(1);
// } // }
uint8_t* output; uint8_t* output = nullptr;
unsigned long size; unsigned long size = 0;
jpeg_mem_dest(&cinfo, &output, &size); jpeg_mem_dest(&cinfo, &output, &size);
/* Step 3: set parameters for compression */ /* Step 3: set parameters for compression */
@@ -203,6 +203,7 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
/* This is an important step since it will release a good deal of memory. */ /* This is an important step since it will release a good deal of memory. */
jpeg_destroy_compress(&cinfo); jpeg_destroy_compress(&cinfo);
free(output);
/* And we're done! */ /* And we're done! */
return js_result; return js_result;