Skip to content
  • Albert Astals Cid's avatar
    greallocn: Make gcc 12.1 happier · 4eeb3380
    Albert Astals Cid authored
    Without this hint that bytes is always going to be > 0 we got a million
    of warnings like
    
    In function ‘void gfree(void*)’,
        inlined from ‘void* greallocn(void*, int, int, bool, bool)’ at goo/gmem.h:178:14,
        inlined from ‘void CharCodeToUnicode::setMapping(CharCode, Unicode*, int)’ at poppler/CharCodeToUnicode.cc:648:60:
    goo/gmem.h:65:14: warning: pointer used after ‘void free(void*)’ [-Wuse-after-free]
       65 |     std::free(p);
          |     ~~~~~~~~~^~~
    In function ‘void gfree(void*)’,
        inlined from ‘void* grealloc(void*, size_t, bool)’ at goo/gmem.h:73:14,
        inlined from ‘void* greallocn(void*, int, int, bool, bool)’ at goo/gmem.h:174:27,
        inlined from ‘void CharCodeToUnicode::setMapping(CharCode, Unicode*, int)’ at poppler/CharCodeToUnicode.cc:648:60:
    goo/gmem.h:65:14: note: call to ‘void free(void*)’ here
       65 |     std::free(p);
          |     ~~~~~~~~~^~~
    4eeb3380