Skip to content
  • Pekka Paalanen's avatar
    shared: rewrite fail_on_null() as abort_oom_if_null() · 9229a451
    Pekka Paalanen authored
    
    
    Recently I learnt that fprintf() is not async-signal-safe. Maybe it also
    attempts to allocate memory sometimes. Hence, using it when we
    presumably are out of memory is wishful thinking.
    
    Therefore replace that with async-signal-safe code. If you have to check
    pointers from traditional signal handlers, now you could do that too!
    
    While doing this, we also lose the string formatting for line number. I
    would argue that printing file and line number is not that useful, if
    the system really is out of memory. If not out of memory, a core dump
    would give us much more detailed information about what went wrong.
    
    clients/window.c had some calls to fail_on_null() and these are simply
    replaced. They were used for checking that creating new wl_proxy by
    issuing a protocol request worked, and IIRC that only fails on
    out-of-memory, so the same rationale applies here.
    
    Signed-off-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
    9229a451
Loading