-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Description
I think dmtxEncodeDataMatrix should free the image->pxl buffer if the DmtxEncode struct is re-used, e.g.:
unsigned char str[] = "30Q324343430794<OQQ";
DmtxEncode *enc;
enc = dmtxEncodeCreate();
dmtxEncodeDataMatrix(enc, strlen(str), str);
dmtxEncodeDataMatrix(enc, strlen(str), str);
dmtxEncodeDestroy(&enc);
Here the image from the first call gets overwritten: https://github.com/dmtx/libdmtx/blob/master/dmtxencode.c#L222
The call to dmtxEncodeDestroy only deletes the second pixel buffer in my example above, see: https://github.com/dmtx/libdmtx/blob/master/dmtxencode.c#L70
I'd suggest to call dmtxImageDestroy and freeing the pixel buffer in the dmtxEncodeDataMatrix function if an image is present from a previous call.
Metadata
Metadata
Assignees
Labels
No labels