diff --git a/backend/png.c b/backend/png.c index a8e5f049..afadc696 100644 --- a/backend/png.c +++ b/backend/png.c @@ -403,6 +403,7 @@ int maxi_png_plot(struct zint_symbol *symbol, int rotate_angle) } png_to_file(symbol, image_height, image_width, pixelbuf, rotate_angle); + free(pixelbuf); } int png_plot(struct zint_symbol *symbol, int rotate_angle) @@ -786,8 +787,9 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle) textpos = (image_width / 2); draw_string(pixelbuf, symbol->text, textpos, (image_height - 17), image_width, image_height); } - + png_to_file(symbol, image_height, image_width, pixelbuf, rotate_angle); + free(pixelbuf); } int png_handle(struct zint_symbol *symbol, int rotate_angle) @@ -801,4 +803,4 @@ int png_handle(struct zint_symbol *symbol, int rotate_angle) } return error; -} \ No newline at end of file +} diff --git a/frontend/main.c b/frontend/main.c index 18255d05..32aed6eb 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -300,6 +300,7 @@ int main(int argc, char **argv) error_number = data_process(my_symbol, optarg, rotate_angle); if(error_number != 0) { printf("%s\n", my_symbol->errtxt); + ZBarcode_Delete(my_symbol); return 1; } break; @@ -332,7 +333,6 @@ int main(int argc, char **argv) printf(my_symbol->errtxt); printf("\n"); } - ZBarcode_Delete(my_symbol); return error_number;