Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93865880 authored by Ting-Yuan Huang's avatar Ting-Yuan Huang Committed by android-build-merger
Browse files

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

am: a2c763de

Change-Id: I1f827779131f45444f1ed3c42ad5b6dfea14cfe5
parents cb9fbb4c a2c763de
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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) {