Browse Source

Bugfix: ztex: Free lastnonce heap memory if backlog allocation fails

Luke Dashjr 13 years ago
parent
commit
d71fc168ca
1 changed files with 1 additions and 0 deletions
  1. 1 0
      driver-ztex.c

+ 1 - 0
driver-ztex.c

@@ -191,6 +191,7 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
 	backlog = malloc(sizeof(uint32_t)*backlog_max);
 	if (backlog == NULL) {
 		applog(LOG_ERR, "%s: failed to allocate backlog[%d]", ztex->repr, backlog_max);
+		free(lastnonce);
 		return 0;
 	}
 	memset(backlog, 0, sizeof(uint32_t)*backlog_max);