log.c: check for malloc() failure