tracing: do not use `coin` after move in `CCoinsViewCache::AddCoin` #25663

pull rodentrabies wants to merge 1 commits into bitcoin:master from rodentrabies:bugprone-use-after-move changing 1 files +3 −3
  1. rodentrabies commented at 9:58 AM on July 21, 2022: contributor

    This is fix for #25640.

  2. tracing: do not use `coin` after move in `CCoinsViewCache::AddCoin` f8e228476f
  3. in src/coins.cpp:104 in f8e228476f
      98 | @@ -99,9 +99,9 @@ void CCoinsViewCache::AddCoin(const COutPoint &outpoint, Coin&& coin, bool possi
      99 |      TRACE5(utxocache, add,
     100 |             outpoint.hash.data(),
     101 |             (uint32_t)outpoint.n,
     102 | -           (uint32_t)coin.nHeight,
     103 | -           (int64_t)coin.out.nValue,
     104 | -           (bool)coin.IsCoinBase());
     105 | +           (uint32_t)it->second.coin.nHeight,
     106 | +           (int64_t)it->second.coin.out.nValue,
     107 | +           (bool)it->second.coin.IsCoinBase());
    


    jonatack commented at 10:26 AM on July 21, 2022:

    utACK

    An alternative would be to move the TRACE5 call before the std::move.

  4. 0xB10C commented at 9:07 AM on July 29, 2022: contributor

    ACK f8e228476f54b36beacc3fd09038dfeebdac6b3c

    Changes look good. Ran the functional usdt interface tests (with the commits from #25528 cherry-picked). This branch is currently running in the CI here https://cirrus-ci.com/build/4542423555637248.

  5. fanquake referenced this in commit 28a255610e on Jul 29, 2022
  6. fanquake referenced this in commit 930ee87002 on Jul 30, 2022
  7. MarcoFalke merged this on Aug 1, 2022
  8. MarcoFalke closed this on Aug 1, 2022

  9. fanquake referenced this in commit e25b0c6838 on Aug 1, 2022
  10. rodentrabies deleted the branch on Aug 1, 2022
  11. sidhujag referenced this in commit ce9edec74b on Aug 1, 2022
  12. fanquake referenced this in commit 696434d7a0 on Aug 19, 2022
  13. fanquake referenced this in commit f345dc3960 on Aug 30, 2022
  14. bitcoin locked this on Aug 1, 2023

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-17 06:13 UTC

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