Make images smaller using best-in-class codecs, right in the browser.
JavaScript
Fix few more issues detected in MozJPEG wrapper
Ingvar Stepanyan39e5741cb2da
diff --git a/codecs/mozjpeg_enc/mozjpeg_enc.cpp b/codecs/mozjpeg_enc/mozjpeg_enc.cppindex b1528550..28162601 100644--- a/codecs/mozjpeg_enc/mozjpeg_enc.cpp+++ b/codecs/mozjpeg_enc/mozjpeg_enc.cpp@@ -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);// exit(1);// }- uint8_t* output;- unsigned long size;+ uint8_t* output = nullptr;+ unsigned long size = 0;jpeg_mem_dest(&cinfo, &output, &size);/* 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. */jpeg_destroy_compress(&cinfo);+ free(output);/* And we're done! */return js_result;