1
0
mirror of https://git.code.sf.net/p/zint/code synced 2025-12-17 18:07:02 +00: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:
Julien Nabet
2017-06-28 21:46:29 +02:00
committed by Robin Stuart
parent 0d6716a773
commit 3257a5c0af
6 changed files with 15 additions and 3 deletions

View File

@@ -123,12 +123,16 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
#ifdef _MSC_VER
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
strcpy(symbol->errtxt, "Can't open output file");
free(bitmap_file_start);
free(bitmap);
return ZINT_ERROR_FILE_ACCESS;
}
#endif
bmp_file = stdout;
} else {
if (!(bmp_file = fopen(symbol->outfile, "wb"))) {
free(bitmap_file_start);
free(bitmap);
strcpy(symbol->errtxt, "Can't open output file (F00)");
return ZINT_ERROR_FILE_ACCESS;
}
@@ -140,4 +144,4 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
free(bitmap_file_start);
free(bitmap);
return 0;
}
}