From d4e666886569933af9e18b926b3304c9cf1ba0b5 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 26 May 2014 22:43:41 +1000 Subject: [PATCH] Fix minor uninitialised ram and leak issues --- src/bitcoin.c | 3 +-- src/libckpool.c | 1 + src/stratifier.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bitcoin.c b/src/bitcoin.c index 9a9bf7c2..b7c7bd4a 100644 --- a/src/bitcoin.c +++ b/src/bitcoin.c @@ -109,8 +109,7 @@ static bool gbt_merkle_bins(gbtbase_t *gbt, json_t *transaction_arr) len += strlen(txn); } - gbt->txn_data = ckalloc(len + 1); - gbt->txn_data[len] = '\0'; + gbt->txn_data = ckzalloc(len + 1); for (i = 0; i < gbt->transactions; i++) { char binswap[32]; diff --git a/src/libckpool.c b/src/libckpool.c index b98e5099..e04ecf08 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -375,6 +375,7 @@ int connect_socket(char *url, char *port) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; + memset(&servinfobase, 0, sizeof(struct addrinfo)); servinfo = &servinfobase; if (getaddrinfo(url, port, &hints, &servinfo) != 0) { diff --git a/src/stratifier.c b/src/stratifier.c index bee5425a..ab14a288 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2035,6 +2035,7 @@ static void load_users(ckpool_t *ckp) LOGDEBUG("Added user %s with %lu shares", instance->username, pplns_shares); } + closedir(dp); } int stratifier(proc_instance_t *pi)