]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 495469 - aligned_alloc and posix_memalign missing MALLOC_TRACE with returned...
authorPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 28 Oct 2024 19:36:17 +0000 (20:36 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 28 Oct 2024 19:36:58 +0000 (20:36 +0100)
NEWS
coregrind/m_replacemalloc/vg_replace_malloc.c

diff --git a/NEWS b/NEWS
index 74679b34ca31a58f937df5ce7a36923029af617a..8fb685ffaa2e2f69201acaa086656845d240ba24 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -83,6 +83,8 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 494252  s390x: incorrect disassembly for LOCHI and friends
 495278  PowerPC instruction dcbf should allow the L field values of 4, 6 on
         ISA 3.0 and earlier, just ignore the value
+495469  aligned_alloc and posix_memalign missing MALLOC_TRACE with returned
+        pointer
 n-i-bz  Improve messages for sigaltstack errors, use specific
         stack_t member names
 
index c8f93bc42df4c31dc77b4e7eb4b149f0beeb4aa5..4125479b82df0005a4ba9525b05427d02dada8c4 100644 (file)
@@ -1781,6 +1781,7 @@ extern int * __error(void) __attribute__((weak));
       MALLOC_TRACE("reallocarray(%p,%llu,%llu)", ptrV, (ULong)nmemb, (ULong)size ); \
       if (nmemb > 0 && (SizeT)-1 / nmemb < size) { \
          SET_ERRNO_ENOMEM; \
+         MALLOC_TRACE(" = 0\n"); \
          return NULL; \
       } \
       v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_realloc, ptrV, nmemb*size ); \
@@ -1987,6 +1988,7 @@ extern int * __error(void) __attribute__((weak));
            (alignment & (alignment - 1)) != 0) ||                              \
           (VG_MEMALIGN_ALIGN_FACTOR_FOUR && (alignment % 4 != 0))) {           \
          SET_ERRNO_EINVAL;                                                     \
+         MALLOC_TRACE(" = 0\n");                                               \
          return 0;                                                             \
       }                                                                        \
       /* Round up to minimum alignment if necessary. */                        \
@@ -2006,6 +2008,8 @@ extern int * __error(void) __attribute__((weak));
       if (!mem)                                                                \
          SET_ERRNO_ENOMEM;                                                     \
                                                                                \
+      MALLOC_TRACE(" = %p\n", mem);                                            \
+                                                                               \
       return mem;                                                              \
    }
 
@@ -2049,6 +2053,8 @@ extern int * __error(void) __attribute__((weak));
       \
       if (!mem) SET_ERRNO_ENOMEM; \
       \
+      MALLOC_TRACE(" = %p\n", mem); \
+      \
       return mem; \
    }
 
@@ -2188,12 +2194,14 @@ extern int * __error(void) __attribute__((weak));
       if (alignment == 0 \
           || alignment % sizeof (void *) != 0 \
           || (alignment & (alignment - 1)) != 0) { \
+         MALLOC_TRACE(" = 0\n"); \
          return VKI_EINVAL; \
       } \
       if (VG_POSIX_MEMALIGN_SIZE_0_RETURN_NULL && \
           size == 0U) { \
          /* no allocation for zero size on Solaris/Illumos */ \
          *memptr = NULL; \
+         MALLOC_TRACE(" = 0\n"); \
          return 0; \
       } \
       /* Round up to minimum alignment if necessary. */ \
@@ -2203,6 +2211,8 @@ extern int * __error(void) __attribute__((weak));
       mem = (void*)VALGRIND_NON_SIMD_CALL3( info.tl_memalign, \
                alignment, orig_alignment, size ); \
       \
+      MALLOC_TRACE(" = %p\n", mem); \
+      \
       if (mem != NULL) { \
         *memptr = mem; \
         return 0; \
@@ -2328,6 +2338,8 @@ extern int * __error(void) __attribute__((weak));
        mem = (void*)VALGRIND_NON_SIMD_CALL3( info.tl_memalign, \
                  alignment, orig_alignment, size ); \
        \
+       MALLOC_TRACE(" = %p\n", mem); \
+       \
        return mem; \
     }
 
@@ -2353,6 +2365,7 @@ extern int * __error(void) __attribute__((weak));
            || (VG_ALIGNED_ALLOC_ALIGN_POWER_TWO && (alignment & (alignment - 1)) != 0) \
            || (VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR && (alignment % 4 != 0))) { \
           SET_ERRNO_EINVAL; \
+          MALLOC_TRACE(" = 0\n"); \
           return 0; \
        } \
        \
@@ -2367,6 +2380,8 @@ extern int * __error(void) __attribute__((weak));
        \
        if (!mem) SET_ERRNO_ENOMEM; \
        \
+       MALLOC_TRACE(" = %p\n", mem); \
+       \
        return mem; \
     }
 #endif