svn commit: r352439 - head/stand/libsa
Toomas Soome
tsoome at FreeBSD.org
Tue Sep 17 09:47:35 UTC 2019
Author: tsoome
Date: Tue Sep 17 09:47:35 2019
New Revision: 352439
URL: https://svnweb.freebsd.org/changeset/base/352439
Log:
loader: factor out guard location setup from Realloc
To simplify and make it easier to read, use ga_Bytes field from guard
structure.
Modified:
head/stand/libsa/zalloc_malloc.c
Modified: head/stand/libsa/zalloc_malloc.c
==============================================================================
--- head/stand/libsa/zalloc_malloc.c Tue Sep 17 09:46:42 2019 (r352438)
+++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 09:47:35 2019 (r352439)
@@ -156,7 +156,9 @@ Realloc(void *ptr, size_t size, const char *file, int
if ((res = Malloc(size, file, line)) != NULL) {
if (ptr) {
- old = *(size_t *)((char *)ptr - MALLOCALIGN) - MALLOCALIGN;
+ Guard *g = (Guard *)((char *)ptr - MALLOCALIGN);
+
+ old = g->ga_Bytes - MALLOCALIGN;
if (old < size)
bcopy(ptr, res, old);
else
More information about the svn-src-head
mailing list