kernel: fix use of uninitialized value in freelist_pop

CID 156233 (#1 of 1): Uninitialized pointer read (UNINIT)5. uninit_use: Using uninitialized value fimg.
This commit is contained in:
Giacomo Tesio 2017-01-15 01:03:35 +01:00
parent c4fb99ec38
commit f2f95a935f
1 changed files with 4 additions and 1 deletions

View File

@ -280,6 +280,8 @@ freelist_pop(int blankslot, int originally_allocated)
unsigned short *next, *fptr; unsigned short *next, *fptr;
ImagePointer ptr = 0; ImagePointer ptr = 0;
fimg = nil;
wlock(&pool_lock); wlock(&pool_lock);
/* if more blanks have been allocated after blankslot, /* if more blanks have been allocated after blankslot,
@ -287,7 +289,8 @@ freelist_pop(int blankslot, int originally_allocated)
* instead * instead
*/ */
if(originally_allocated < pool.allocated){ if(originally_allocated < pool.allocated){
return pool.allocated - blankslot; ptr = pool.allocated - blankslot;
goto Done;
} }
if(pool.sleeping == 0) if(pool.sleeping == 0)