mirror of
https://github.com/cryptonote-social/csminer.git
synced 2024-09-11 05:35:23 +03:00
fix possible double free
This commit is contained in:
parent
1caf52f1df
commit
a0df6f931c
@ -97,7 +97,6 @@ int main(int argc, char* argv[]) {
|
||||
pl_resp = pool_login(&pl_args);
|
||||
if (pl_resp.code < 0) {
|
||||
printf("Oh no, login 2 failed: %s\n", pl_resp.message);
|
||||
free((void*)pl_resp.message);
|
||||
}
|
||||
if (pl_resp.code > 1) {
|
||||
printf("Pool server didn't like login 2 info: %s\n", pl_resp.message);
|
||||
|
@ -369,12 +369,13 @@ func handlePoke(wasMining bool, poke int, stopper *uint32, wg *sync.WaitGroup) i
|
||||
if poke == INCREASE_THREADS_POKE {
|
||||
atomic.StoreUint32(stopper, 1)
|
||||
wg.Wait()
|
||||
configMutex.Lock()
|
||||
t := rx.AddThread()
|
||||
if t < 0 {
|
||||
configMutex.UnLock()
|
||||
crylog.Error("Failed to add another thread")
|
||||
return USE_CACHED
|
||||
}
|
||||
configMutex.Lock()
|
||||
threads = t
|
||||
configMutex.Unlock()
|
||||
crylog.Info("Increased # of threads to:", t)
|
||||
@ -384,12 +385,13 @@ func handlePoke(wasMining bool, poke int, stopper *uint32, wg *sync.WaitGroup) i
|
||||
if poke == DECREASE_THREADS_POKE {
|
||||
atomic.StoreUint32(stopper, 1)
|
||||
wg.Wait()
|
||||
configMutex.Lock()
|
||||
t := rx.RemoveThread()
|
||||
if t < 0 {
|
||||
configMutex.Unlock()
|
||||
crylog.Error("Failed to decrease threads")
|
||||
return USE_CACHED
|
||||
}
|
||||
configMutex.Lock()
|
||||
threads = t
|
||||
configMutex.Unlock()
|
||||
crylog.Info("Decreased # of threads to:", t)
|
||||
|
Loading…
Reference in New Issue
Block a user