Skip to content

Commit b336873

Browse files
authored
Merge pull request #540 from daykin/master
Fix: plug memory leak in NDCodec (de)compressJPEG
2 parents 84da957 + 706fc91 commit b336873

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ADApp/pluginSrc/NDPluginCodec.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ NDArray *compressJPEG(NDArray *input, int quality, NDCodecStatus_t *status, char
245245

246246
output = allocArray(input, -1, outSize, outData);
247247

248+
jpeg_destroy_compress(&jpegInfo);
249+
248250
if (!output) {
249251
sprintf(errorMessage, "Failed to allocate JPEG array");
250252
*status = NDCODEC_ERROR;
@@ -320,6 +322,8 @@ NDArray *decompressJPEG(NDArray *input, NDCodecStatus_t *status, char *errorMess
320322
&colorMode);
321323
output->codec.clear();
322324

325+
jpeg_destroy_decompress(&jpegInfo);
326+
323327
return output;
324328
}
325329

0 commit comments

Comments
 (0)