syscall_filter: Check getline(3) return value.
am: 960b56b84b
Change-Id: I42528ce1a1898618ad80d59eefbcb378892b0f57
diff --git a/syscall_filter.c b/syscall_filter.c
index f90878a..9dd7fb2 100644
--- a/syscall_filter.c
+++ b/syscall_filter.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -647,6 +648,14 @@
}
/* Reuse |line| in the next getline() call. */
}
+ /* getline(3) returned -1. This can mean EOF or the below errors. */
+ if (errno == EINVAL || errno == ENOMEM) {
+ if (*arg_blocks) {
+ free_block_list(*arg_blocks);
+ *arg_blocks = NULL;
+ }
+ ret = -1;
+ }
free_line:
free(line);