kits/midi2: Fix PVS 820
Fix memory leak when realloc() fails. Change-Id: Ic787ca714e4a106cc22e6186078a8e72d0a0553d Reviewed-on: https://review.haiku-os.org/c/1006 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
21392fa9b1
commit
f465c7fa61
@@ -345,7 +345,10 @@ BMidiLocalConsumer::EventThread()
|
||||
break; // error reading port
|
||||
|
||||
if (msg_size > buf_size) {
|
||||
buffer = (uint8*) realloc(buffer, msg_size);
|
||||
uint8* tmp_buffer = (uint8*) realloc(buffer, msg_size);
|
||||
if (tmp_buffer == NULL)
|
||||
break; // error in realloc()
|
||||
buffer = tmp_buffer;
|
||||
buf_size = msg_size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user