SCI: Fix incorrect usage of sizeof
Thanks to salty-horse for the reports.
This commit is contained in:
parent
4cbf30a88c
commit
bc4691a23e
2 changed files with 4 additions and 3 deletions
|
@ -257,7 +257,8 @@ int DecompressorLZW::unpackLZW1(Common::ReadStream *src, byte *dest, uint32 nPac
|
|||
init(src, dest, nPacked, nUnpacked);
|
||||
|
||||
byte *stak = (byte *)malloc(0x1014);
|
||||
Tokenlist *tokens = (Tokenlist *)malloc(0x1004 * sizeof(Tokenlist));
|
||||
unsigned int tokensSize = 0x1004 * sizeof(Tokenlist);
|
||||
Tokenlist *tokens = (Tokenlist *)malloc(tokensSize);
|
||||
if (!stak || !tokens) {
|
||||
free(stak);
|
||||
free(tokens);
|
||||
|
@ -265,7 +266,7 @@ int DecompressorLZW::unpackLZW1(Common::ReadStream *src, byte *dest, uint32 nPac
|
|||
error("[DecompressorLZW::unpackLZW1] Cannot allocate decompression buffers");
|
||||
}
|
||||
|
||||
memset(tokens, 0, sizeof(tokens));
|
||||
memset(tokens, 0, tokensSize);
|
||||
|
||||
byte lastchar = 0;
|
||||
uint16 stakptr = 0, lastbits = 0;
|
||||
|
|
|
@ -462,7 +462,7 @@ int readPMachineInstruction(const byte *src, byte &extOpcode, int16 opparams[4])
|
|||
extOpcode = src[offset++]; // Get "extended" opcode (lower bit has special meaning)
|
||||
const byte opcode = extOpcode >> 1; // get the actual opcode
|
||||
|
||||
memset(opparams, 0, sizeof(opparams));
|
||||
memset(opparams, 0, 4*sizeof(int16));
|
||||
|
||||
for (int i = 0; g_opcode_formats[opcode][i]; ++i) {
|
||||
//debugN("Opcode: 0x%x, Opnumber: 0x%x, temp: %d\n", opcode, opcode, temp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue