stan-dev/stan — pull request #423 by mbrubake (2013-11-28 22:09:33+00:00)
Title: Fix memory errors found when tracking down issue #389

- Summary: Resolves issue #389 by fixing bernoulli_log and ensures that other examples of such a bug (which may not clearly manifest) will show up immediately by changing how OperandsAndPartials functions.

- Intended Effect: Instead of using include_summand in bernoulli_log use is_constant_struct to determine whether to update the partials. The pointers to partials in OperandsAndPartials are now initialized to NULL if the corresponding parameter is constant so any accesses will cause a segfault.

- How to Verify: The model from #389 now runs fine.

- Side Effects: Fixed a memory error in dump.hpp that showed up when running valgrind. The bug itself is mostly harmless and was unlikely to ever be an issue, but the code was fixed to cleanup the valgrind output and because it's the "right thing to do".

- Documentation: Not user facing, so no need for doc updates.

- Reviewer Suggestions: @bob-carpenter or @syclik most likely