add safety checks in init before calling delete #4912

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:init changing 1 files +34 −18
  1. Diapolo commented at 11:08 AM on September 14, 2014: none
    • init pwalletMain and pcoinsdbview to NULL
    • add or extend NULL pointer checks before deleting any of pblocktree, pcoinsTip, pcoinsdbview or pwalletMain
    • change a LogPrintf for nScriptCheckThreads from unsigned to %d as it is an integer
  2. add safety checks in init before calling delete
    - init pwalletMain and pcoinsdbview to NULL
    - add or extend NULL pointer checks before deleting any of pblocktree,
      pcoinsTip, pcoinsdbview or pwalletMain
    - change a LogPrintf for nScriptCheckThreads from unsigned to %d as it is
      an integer
    f757d3ea1f
  3. BitcoinPullTester commented at 11:37 AM on September 14, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4912_f757d3ea1f3a39e911331076975b74095bfa7e62/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  4. sipa commented at 3:29 PM on September 14, 2014: member

    Not a NAK, but just so you know, all of these are no ops:

    • Global variables are always initialized to zero (though I don't mind making the initialization value more explicit).
    • It is legal to delete a NULL.
    • Tinyformat treats %u, %i and %d identically, and uses the actual data type to determine whether to use signed or unsigned conversion.
  5. jgarzik commented at 1:27 AM on September 15, 2014: contributor

    I don't mind more explicit init.

    NAK on the added "if (foo) delete ..."

    It is a standard janitor cleanup to remove such "if (...)" tests prior to delete or free(3).

  6. laanwj commented at 7:01 AM on September 15, 2014: member

    This is completely unnecessary...

  7. jgarzik closed this on Sep 15, 2014

  8. Diapolo deleted the branch on Sep 16, 2014
  9. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me