Commit 9412ab33 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Merge branch 'fix-realloc' into 'master'

Fixed realloc due to gcc > 12 on hosts

See merge request certo/linux!1
parents 263c2e42 e4f0d123
......@@ -329,6 +329,9 @@ CONFIG_CROSS_COMPILE="${CLFS_TARGET}"
<exec executable="tar" failonerror="true">
<arg line="xf packages/linux/linux-5.12.10.tar.xz -C ${builddir}"/>
</exec>
<exec executable="patch" dir="${builddir}/linux-5.12.10" failonerror="true">
<arg line="-Np1 -i ${basedir}/packages/linux/linux-5.12.10-realloc.patch"/>
</exec>
<exec executable="make" dir="${makedir}" failonerror="true">
<env key="PATH" path="${PATH}"/>
<env key="CC" value="${CLFS_TARGET}-gcc"/>
......
diff -uNr linux-5.12.10/tools/lib/subcmd/subcmd-util.h linux-5.12.10-realloc-fix/tools/lib/subcmd/subcmd-util.h
--- linux-5.12.10/tools/lib/subcmd/subcmd-util.h 2021-06-10 19:41:49.000000000 +0800
+++ linux-5.12.10-realloc-fix/tools/lib/subcmd/subcmd-util.h 2023-07-25 13:46:35.201768582 +0800
@@ -49,13 +49,12 @@
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");
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment