summarylogtreecommitdiffstats
path: root/nmemalign.patch
diff options
context:
space:
mode:
authorJanez Zemva2017-09-04 21:03:29 +0200
committerJanez Zemva2017-09-04 21:03:29 +0200
commit12760a3c06c4e6945ee0cb74834d1cfb2acbbb9e (patch)
tree29301344d03855c151be458ed08367b4f68654c4 /nmemalign.patch
downloadaur-12760a3c06c4e6945ee0cb74834d1cfb2acbbb9e.tar.gz
initial commit
Diffstat (limited to 'nmemalign.patch')
-rw-r--r--nmemalign.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/nmemalign.patch b/nmemalign.patch
new file mode 100644
index 000000000000..19310a8e182b
--- /dev/null
+++ b/nmemalign.patch
@@ -0,0 +1,22 @@
+--- src/libc/ansi/stdlib/nmalloc.c
++++ src/libc/ansi/stdlib/nmalloc.c
+@@ -1145,6 +1145,7 @@
+ return nmalloc(szneed); /* EXIT */
+ }
+ else if ((minit = nmalloc(szneed + XTRA))) {
++ m = MEMBLKp(minit);
+ /* alignment >= 2*ALIGN and power of 2 if here */
+ misalign = (ulong)minit % alignment;
+ DBGPRTM(" misalignment = %d", misalign);
+@@ -1154,9 +1155,10 @@
+ }
+ else {
+ /* two or more chunks to release */
+- /* for now, just return NULL and have a leak */
+ DBGPRTM(" Complex case, release multiple chunks");
+ DBGEOLN;
++ nfree(PTR(split(&m, alignment - misalign)));
++ return nrealloc(PTR(m), size);
+ }
+ } /* alignment > ALIGN */
+ } /* valid parameters */