Reacted on warning about theoretical memory leak.

This commit is contained in:
Thomas Schmitt 2011-03-28 20:43:13 +02:00
parent 71efc996e3
commit c0bdf4d3b5
1 changed files with 6 additions and 4 deletions

View File

@ -337,14 +337,16 @@ static
int rrip_add_NM(Ecma119Image *t, struct susp_info *susp, char *name, int size,
int flags, int ce)
{
uint8_t *NM = malloc(size + 5);
if (NM == NULL) {
return ISO_OUT_OF_MEM;
}
uint8_t *NM;
if (size > 250)
return ISO_ASSERT_FAILURE;
NM = malloc(size + 5);
if (NM == NULL) {
return ISO_OUT_OF_MEM;
}
NM[0] = 'N';
NM[1] = 'M';
NM[2] = size + 5;