Skip to content

Commit 4a950af

Browse files
committed
USBKeyboard: free buffer memory when kbd alloc fails
1 parent e9274af commit 4a950af

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

libwiikeyboard/usbkeyboard.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ s32 USBKeyboard_Open(const eventcallback cb)
252252
_kbd = (struct ukbd *) malloc(sizeof(struct ukbd));
253253

254254
if (!_kbd)
255+
{
256+
iosFree(hId, buffer);
255257
return -1;
258+
}
256259
}
257260

258261
memset(_kbd, 0, sizeof(struct ukbd));

0 commit comments

Comments
 (0)