We are using Sentry (a C/C++ static analysis tool) to analyze
mongodb on a nightly basis. Sentry found that a dead assignment
was recently introduced in the commit 884e100.
While reviewing that issue, I also noticed a potential NULL
dereference that Sentry found.
I've provided a patch for each issue.
I can see from the code that the dead assignment was at one point a
debugging variable. However, the assert was commented out, and thought
it might be nice to clean up the code. If this isn't the case, please disregard this patch.
The NULL dereference could be a potentially serious bug if targetHost can be NULL
when entering the function.
I'm not sure either of these patches are the correct patch considering I don't know
the code that well, hopefully you can investigate.
Vigilant Software, A C/C++ Static Analysis Company