kopia lustrzana https://gitlab.com/sane-project/backends
escl: fix char_to_array memory allocation calculations
Too little memory allocated due to incorrect calculation. Fixes #425escl-fix-sleep-mode
rodzic
d46fbd9d79
commit
891ccac3b6
|
@ -90,9 +90,9 @@ char_to_array(SANE_String_Const *tab, int *tabsize, SANE_String_Const mode, int
|
|||
}
|
||||
(*tabsize)++;
|
||||
if (*tabsize == 1)
|
||||
board = (SANE_String_Const *)malloc(sizeof(SANE_String_Const) * (*tabsize) + 1);
|
||||
board = (SANE_String_Const *)malloc(sizeof(SANE_String_Const) * ((*tabsize) + 1));
|
||||
else
|
||||
board = (SANE_String_Const *)realloc(tab, sizeof(SANE_String_Const) * (*tabsize) + 1);
|
||||
board = (SANE_String_Const *)realloc(tab, sizeof(SANE_String_Const) * ((*tabsize) + 1));
|
||||
board[*tabsize - 1] = (SANE_String_Const)strdup(convert);
|
||||
board[*tabsize] = NULL;
|
||||
return (board);
|
||||
|
|
Ładowanie…
Reference in New Issue