[qt] Fix potential memory leak in newPossibleKey(ChangeCWallet *wallet) #10920

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:fix-newPossibleKeyChange-memory-leak changing 2 files +3 −5
  1. practicalswift commented at 8:34 PM on July 24, 2017: contributor

    Fix potential memory leak in newPossibleKey(ChangeCWallet *wallet).

  2. sipa commented at 10:31 PM on July 24, 2017: member

    Is it possible to change this to use a unique_ptr instead?

  3. promag commented at 11:24 PM on July 24, 2017: member

    :+1: @sipa suggestion.

    Correct me if I'm wrong, but from what I've seen, WalletModelTransaction::keyChange pointer is initialized to null, and only has a value when newPossibleKeyChange is called. So, in the first call, this would delete NULL.

    Moreover, in the ~WalletModelTransaction it also delete keyChange which can be null if newPossibleKeyChange is not called.

  4. practicalswift commented at 8:00 AM on July 25, 2017: contributor

    @sipa Sure, I'll fix! @promag We're doing delete NULL all over the codebase assuming it is a no-op :-)

  5. promag commented at 8:42 AM on July 25, 2017: member

    Yeah it's safe, can be avoided though.

  6. luke-jr commented at 6:41 AM on July 26, 2017: member

    But there's no reason to avoid it..

  7. practicalswift force-pushed on Aug 7, 2017
  8. practicalswift force-pushed on Aug 7, 2017
  9. practicalswift commented at 2:29 PM on August 7, 2017: contributor

    Now using unique_ptr. Please review :-)

  10. [qt] Fix potential memory leak in newPossibleKey(ChangeCWallet *wallet) 446e2610b0
  11. practicalswift force-pushed on Aug 7, 2017
  12. jonasschnelli commented at 3:04 PM on August 7, 2017: contributor

    utACK 1ce39c59c22a5878b5af6a4ff821db83c988e8b7

  13. ryanofsky commented at 3:05 PM on August 7, 2017: member

    utACK 446e2610b0cd6535e623952bf22ea09ce0ed8aaf. FWIW #10244 (commit "Remove most direct bitcoin calls from qt/walletmodel.cpp") takes this cleanup further, combining key and transaction into a pending transaction object and referencing that through a unique pointer.

  14. MarcoFalke added the label GUI on Sep 25, 2017
  15. promag commented at 5:19 PM on October 8, 2017: member

    utACK 446e261.

  16. laanwj commented at 12:07 PM on November 17, 2017: member

    utACK 446e261

  17. laanwj merged this on Nov 17, 2017
  18. laanwj closed this on Nov 17, 2017

  19. laanwj referenced this in commit f6f8d54aff on Nov 17, 2017
  20. PastaPastaPasta referenced this in commit 8170ad7a65 on Jan 17, 2020
  21. PastaPastaPasta referenced this in commit c6dc88b440 on Jan 22, 2020
  22. PastaPastaPasta referenced this in commit 9957b034d5 on Jan 22, 2020
  23. PastaPastaPasta referenced this in commit 2ccefac040 on Jan 29, 2020
  24. PastaPastaPasta referenced this in commit 581c49d88d on Jan 29, 2020
  25. PastaPastaPasta referenced this in commit 11d59e785d on Jan 29, 2020
  26. ckti referenced this in commit dafa9b9177 on Mar 28, 2021
  27. practicalswift deleted the branch on Apr 10, 2021
  28. gades referenced this in commit 8496eedef9 on Mar 8, 2022
  29. DrahtBot locked this on Aug 18, 2022

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-16 15:15 UTC

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