cppcheck: add special BUG_ON so cppcheck understands we exit
port parsing: improve memory handling
http header: improve realloc failure checking. Bug #1062.