https://bugs.kde.org/show_bug.cgi?id=217695

Mark Wielaard <m...@klomp.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Mark Wielaard <m...@klomp.org> ---
commit 1c9a0bf58a47e855e6e5bf78a30bcee0af835804
Author: Mark Wielaard <m...@klomp.org>
Date:   Fri Feb 12 23:29:34 2021 +0100

    PR217695 malloc/calloc/realloc/memalign failure doesn't set errno to ENOMEM

    When one of the allocation functions in vg_replace_malloc failed
    they return NULL, but didn't set errno. This is slightly tricky since
    errno is implementation defined and might be a macro. In the case of
    glibc ernno is defined as:

      extern int *__errno_location (void) __THROW __attribute__ ((__const__));
      #define errno (*__errno_location ())

    We can use the same trick as we use for __libc_freeres in
    coregrind/vg_preloaded.c. Define the function as "weak". This means
    it will only be defined if another library (glibc in this case)
    actually provides a definition. Otherwise it will be NULL.
    So we will only call it if it is defined and one of the allocation
    functions failed, returned NULL.

    Include a new linux only memcheck testcase, enomem.vgtest.

    https://bugs.kde.org/show_bug.cgi?id=217695

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to