blob: ac063292e0a6e064863bff94467629e13655d852 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
From b3d2907a37c53f7379be8742bfbfe47aa2877bfc Mon Sep 17 00:00:00 2001
From: "Justin M. Forbes" <jforbes@fedoraproject.org>
Date: Thu, 27 Jan 2022 15:33:37 -0600
Subject: [PATCH] Fix subcmd-util for gcc 12
Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
---
tools/lib/subcmd/subcmd-util.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/lib/subcmd/subcmd-util.h b/tools/lib/subcmd/subcmd-util.h
index 794a375dad36..7009fc176636 100644
--- a/tools/lib/subcmd/subcmd-util.h
+++ b/tools/lib/subcmd/subcmd-util.h
@@ -49,13 +49,12 @@ static NORETURN inline void die(const char *err, ...)
static inline void *xrealloc(void *ptr, size_t size)
{
- void *ret = realloc(ptr, size);
- if (!ret && !size)
- ret = realloc(ptr, 1);
+ void *ret;
+ if (!size)
+ size = 1;
+ ret = realloc(ptr, size);
if (!ret) {
ret = realloc(ptr, size);
- if (!ret && !size)
- ret = realloc(ptr, 1);
if (!ret)
die("Out of memory, realloc failed");
}
--
2.34.1
|