diff --git a/backend/raster.c b/backend/raster.c index b26dcbaa..d6c61d72 100644 --- a/backend/raster.c +++ b/backend/raster.c @@ -96,7 +96,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int char *rotated_pixbuf; if (!(rotated_pixbuf = (char *) malloc(image_width * image_height))) { - printf("Insufficient memory for pixel buffer (F50)"); + strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F50)"); return ZINT_ERROR_ENCODING_PROBLEM; } @@ -490,7 +490,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_ image_height = (300 + (2 * yoffset * 2)) * scaler; if (!(pixelbuf = (char *) malloc(image_width * image_height))) { - printf("Insufficient memory for pixel buffer (F55)"); + strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F55)"); return ZINT_ERROR_ENCODING_PROBLEM; } else { for (i = 0; i < (image_width * image_height); i++) { @@ -501,7 +501,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_ hexagon_size = (int)scaler * 10; if (!(scaled_hexagon = (char *) malloc(hexagon_size * hexagon_size))) { - printf("Insufficient memory for pixel buffer (F56)"); + strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F56)"); free(scaled_hexagon); return ZINT_ERROR_ENCODING_PROBLEM; } else { @@ -611,7 +611,7 @@ int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_typ /* Apply scale options by creating another pixel buffer */ if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) { - printf("Insufficient memory for pixel buffer (F57)"); + strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F57)"); return ZINT_ERROR_ENCODING_PROBLEM; } else { for (i = 0; i < (scale_width * scale_height); i++) { @@ -786,7 +786,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t image_height = 2 * (symbol->height + textoffset + yoffset + yoffset); if (!(pixelbuf = (char *) malloc(image_width * image_height))) { - printf("Insufficient memory for pixel buffer (F58)"); + strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F58)"); return ZINT_ERROR_ENCODING_PROBLEM; } else { for (i = 0; i < (image_width * image_height); i++) { @@ -1089,7 +1089,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t /* Apply scale options by creating another pixel buffer */ if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) { free(pixelbuf); - printf("Insufficient memory for pixel buffer (F59)"); + strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F59)"); return ZINT_ERROR_ENCODING_PROBLEM; } else { for (i = 0; i < (scale_width * scale_height); i++) {