diff --git a/man/buildman.sh b/man/buildman.sh new file mode 100755 index 000000000..2be77f898 --- /dev/null +++ b/man/buildman.sh @@ -0,0 +1,8 @@ +#/bin/sh + +xsltproc -o manual.html /usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl manual.docbook + +xsltproc -o intermediate-fo-file.fo /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl manual.docbook + +fop -pdf manual.pdf -fo intermediate-fo-file.fo + diff --git a/man/manual.docbook b/man/manual.docbook index e0b4692ef..203ae68b8 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -423,6 +423,24 @@ void DestroyFred(void *p) If an exception occurs when b is allocated, a will leak. - + Here is another example: + + int *p; + +int a(int sz) +{ + delete [] p; + if (sz <= 0) + throw std::runtime_error("size <= 0"); + p = new int[sz]; +} + + Check that with Cppcheck: + + cppcheck --enable=exceptNew,exceptRealloc except2.cpp + + The output from Cppcheck is: + + [except2.cpp:7]: (error) Throwing exception in invalid state, p points at deallocated memory