mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-09 13:41:59 -04:00
malloc/calloc: check for NULL always (11.1.0 gcc -fanalyzer -c backend/*.c)
ZBarcode_Encode: don't reinit symbol->outfile, props Alonso Schaich frontend/test_args: skip long filename tests on Windows, props Alonso Schaich
This commit is contained in:
parent
8c419ab4fb
commit
368633bda4
9 changed files with 131 additions and 55 deletions
|
@ -620,7 +620,13 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) {
|
|||
assert(str->length > 0);
|
||||
utfle_len = utfle_length(str->text, str->length);
|
||||
bumped_len = bump_up(utfle_len) * 2;
|
||||
this_string[this_text] = (unsigned char *) malloc(bumped_len);
|
||||
if (!(this_string[this_text] = (unsigned char *) malloc(bumped_len))) {
|
||||
for (i = 0; i < this_text; i++) {
|
||||
free(this_string[i]);
|
||||
}
|
||||
strcpy(symbol->errtxt, "641: Insufficient memory for EMF string buffer");
|
||||
return ZINT_ERROR_MEMORY;
|
||||
}
|
||||
memset(this_string[this_text], 0, bumped_len);
|
||||
text[this_text].type = 0x00000054; // EMR_EXTTEXTOUTW
|
||||
text[this_text].size = 76 + bumped_len;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue