Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-3285

Dead Assignment/Variable added in commit 884e100 (also a NULL dereference bug)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.9.1
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • ALL

      Hi,

      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.

      Thanks,
      Chris


      Chris Wilson
      http://vigilantsw.com/
      Vigilant Software, A C/C++ Static Analysis Company

            Assignee:
            kristina Kristina Chodorow (Inactive)
            Reporter:
            cwilson Chris Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: