psmisc/backport-0007-peekfd-exit-after-perror.patch

30 lines
861 B
Diff
Raw Normal View History

2020-11-03 14:21:18 +08:00
From 02d3bdc1f283645e537b35e1a9cad34e40615277 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Mon, 2 Mar 2020 22:27:20 +1100
Subject: [PATCH 13/20] peekfd: exit() after perror()
https://gitlab.com/psmisc/psmisc/-/commit/02d3bdc1f283645e537b35e1a9cad34e40615277
---
src/peekfd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/peekfd.c b/src/peekfd.c
index 360b2f7..36dff04 100644
--- a/src/peekfd.c
+++ b/src/peekfd.c
@@ -415,8 +415,10 @@ int main(int argc, char **argv)
if (remove_duplicates) {
if (lastbuf)
free(lastbuf);
- if ( NULL == (lastbuf = malloc(regs.REG_PARAM3)))
+ if ( NULL == (lastbuf = malloc(regs.REG_PARAM3))) {
perror("lastbuf malloc");
+ exit(1);
+ }
last_buf_size = regs.REG_PARAM3;
}
--
2.22.0.windows.1