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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to