Browse Source

Fix memleaks

jl777
jl777 7 years ago
parent
commit
cac7b051ea
  1. 1
      iguana/exchanges/LP_rpc.c
  2. 10
      iguana/exchanges/LP_swap.c

1
iguana/exchanges/LP_rpc.c

@ -468,6 +468,7 @@ cJSON *LP_listreceivedbyaddress(char *symbol,char *coinaddr)
}
}
}
free_json(array);
}
return(cJSON_Parse("[]"));
} else return(electrum_address_gethistory(symbol,coin->electrum,&retjson,coinaddr,zero));

10
iguana/exchanges/LP_swap.c

@ -793,13 +793,12 @@ uint32_t LP_swapwait(uint32_t expiration,uint32_t requestid,uint32_t quoteid,int
if ( jstr(retjson,"status") != 0 && strcmp(jstr(retjson,"status"),"finished") == 0 )
{
finished = (uint32_t)time(NULL);
free(retstr);
free(retstr), retstr = 0;
break;
}
else if ( expiration != 0 && time(NULL) > expiration )
printf("NOT FINISHED.(%s)\n",jprint(retjson,0));
free_json(retjson);
retjson = 0;
free_json(retjson), retjson = 0;
}
free(retstr);
}
@ -1281,11 +1280,14 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256
struct basilisk_swap *LP_swapinit(int32_t iambob,int32_t optionduration,bits256 privkey,struct basilisk_request *rp,struct LP_quoteinfo *qp,int32_t dynamictrust)
{
static void *ctx;
struct basilisk_swap *swap; bits256 pubkey25519; uint8_t pubkey33[33];
if ( ctx == 0 )
ctx = bitcoin_ctx();
swap = calloc(1,sizeof(*swap));
swap->aliceid = LP_aliceid_calc(qp->desttxid,qp->destvout,qp->feetxid,qp->feevout);
swap->I.req.quoteid = rp->quoteid;
swap->ctx = bitcoin_ctx();
swap->ctx = ctx;
vcalc_sha256(0,swap->I.orderhash.bytes,(uint8_t *)rp,sizeof(*rp));
swap->I.req = *rp;
G.LP_skipstatus[G.LP_numskips] = ((uint64_t)rp->requestid << 32) | rp->quoteid;

Loading…
Cancel
Save