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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 1.9.1
    • Replication
    • None
    • ALL

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: