mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-12 22:25:59 -04:00
cppcheck: fix reports
[backend/bmp.c:133]: (error) Memory leak: bitmap [backend/bmp.c:126]: (error) Memory leak: bitmap [backend/composite.c:464]: (error) Array index -1 is out of bounds. [backend/composite.c:507]: (error) Array index -1 is out of bounds. [backend/dmatrix.c:962]: (style) Redundant condition: i!=0. 'i==0 || (i!=0 && binary[i-1]!='b')' is equivalent to 'i==0 || binary[i-1]!='b'' [backend/raster.c:122]: (error) Memory leak: rotated_pixbuf [backend/raster.c:506]: (error) Memory leak: pixelbuf [frontend/main.c:273]: (error) Uninitialized variable: format_string [frontend_qt/exportwindow.cpp:103]: (style) Array index 'j' is used before limits check.
This commit is contained in:
parent
0d6716a773
commit
3257a5c0af
6 changed files with 15 additions and 3 deletions
|
@ -119,20 +119,24 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int
|
|||
|
||||
if (strlen(symbol->fgcolour) != 6) {
|
||||
strcpy(symbol->errtxt, "Malformed foreground colour target (F51)");
|
||||
free(rotated_pixbuf);
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
if (strlen(symbol->bgcolour) != 6) {
|
||||
strcpy(symbol->errtxt, "Malformed background colour target (F52)");
|
||||
free(rotated_pixbuf);
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour));
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Malformed foreground colour target (F53)");
|
||||
free(rotated_pixbuf);
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->fgcolour));
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Malformed background colour target (F54)");
|
||||
free(rotated_pixbuf);
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
|
@ -181,6 +185,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int
|
|||
#ifndef NO_PNG
|
||||
error_number = png_pixel_plot(symbol, rotated_pixbuf);
|
||||
#else
|
||||
free(rotated_pixbuf);
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
#endif
|
||||
break;
|
||||
|
@ -503,6 +508,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
|
|||
if (!(scaled_hexagon = (char *) malloc(hexagon_size * hexagon_size))) {
|
||||
strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F56)");
|
||||
free(scaled_hexagon);
|
||||
free(pixelbuf);
|
||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||
} else {
|
||||
for (i = 0; i < (hexagon_size * hexagon_size); i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue