Merge "toolbox: exit when failed to allocate buffer for ioctl" am: 16017b3fbb am: a2c763de6f

am: 93865880e5

Change-Id: I4cf73ee6b9cdd1c1fda73a03b9299ac40adc235b
This commit is contained in:
Ting-Yuan Huang 2016-11-23 01:48:31 +00:00 committed by android-build-merger
commit d05783f75d
1 changed files with 3 additions and 4 deletions

View File

@ -9,6 +9,7 @@
#include <sys/limits.h>
#include <sys/poll.h>
#include <linux/input.h>
#include <err.h>
#include <errno.h>
#include <unistd.h>
@ -110,10 +111,8 @@ static int print_possible_events(int fd, int print_flags)
break;
bits_size = res + 16;
bits = realloc(bits, bits_size * 2);
if(bits == NULL) {
fprintf(stderr, "failed to allocate buffer of size %d\n", (int)bits_size);
return 1;
}
if(bits == NULL)
err(1, "failed to allocate buffer of size %d\n", (int)bits_size);
}
res2 = 0;
switch(i) {