From 829dcf9d2b4b1430b240ec5afbab29c9c2804900 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 22 Feb 2012 21:07:41 -0500 Subject: [PATCH] Bugfix: Fix BitFORCE driver memory leak in debug logging --- bitforce.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bitforce.c b/bitforce.c index aaeef007..c283a61c 100644 --- a/bitforce.c +++ b/bitforce.c @@ -204,6 +204,7 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6 unsigned char ob[61] = ">>>>>>>>12345678901234567890123456789012123456789012>>>>>>>>"; int i; char *pnoncebuf; + char *pblkdata; uint32_t nonce; BFwrite(fdDev, "ZDX", 3); @@ -220,7 +221,11 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6 memcpy(ob + 8, work->midstate, 32); memcpy(ob + 8 + 32, work->data + 64, 12); BFwrite(fdDev, ob, 60); - applog(LOG_DEBUG, "BitForce block data: %s", bin2hex(ob + 8, 44)); + if (opt_debug) { + pblkdata = bin2hex(ob + 8, 44); + applog(LOG_DEBUG, "BitForce block data: %s", pblkdata); + free(pblkdata); + } BFgets(pdevbuf, sizeof(pdevbuf), fdDev); if (unlikely(!pdevbuf[0])) {