Closed idigger closed 5 months ago
It certainly is a bug and your suggested fix seems to align with the intent but I'd like more info. This code is in an error path, how did you discover the bug? Did you experience the error forcing this path to run? If so what was the result? Did you test the fix?
I just found it when I was upgrading compared to the old code before, no testing.
Thanks, just wanted to make sure I had all the info. It appears this code has never been run. When I made the merkle malloc optimization I left the error path as is as a fallback. That appears to have led to a copy/paste error where I didn't fix the index variable in the free loop. After thinking a bit more about it there is no need to free the merkle tree on this error (should it ever occur) since the tree was not in error, the message was. As a result the free loop, the freeing of the merkle head pointer and zeroing of the merkle buff size will be removed in the next release.
I hope cpuminer-opt will get better and better. I wonder if randomx and ghostrider algorithm can be added.
Line 2079 in util.c free( sctx->job.merkle[i] ); ===> free(sctx->job.merkle[j]);