Abstract: The following code has an impressive bug in the book Writing Solid Code)
pbBuf = (char *)realloc(pbBuf, sizeNew); if (pbBuf != NULL){ /* do something */ }Can you see the bug? It's a serious bug. pbBuf pointed to a legal address, and sizeNew > 0 when the realloc is called.
Before start to read here, please think about that a while. If you know a bug is here, you may be able to find that.