Fix potential memleak of shares in ckproxy generator code.
This commit is contained in:
parent
51a9860bb8
commit
d385b74b6f
@ -1772,8 +1772,10 @@ static int parse_share(gdata_t *gdata, proxy_instance_t *proxi, const char *buf)
|
||||
|
||||
mutex_lock(&gdata->share_lock);
|
||||
HASH_FIND_I64(gdata->shares, &id, share);
|
||||
if (share)
|
||||
if (share) {
|
||||
HASH_DEL(gdata->shares, share);
|
||||
free(share);
|
||||
}
|
||||
mutex_unlock(&gdata->share_lock);
|
||||
|
||||
if (!share) {
|
||||
@ -2401,6 +2403,7 @@ static void *proxy_recv(void *arg)
|
||||
HASH_ITER(hh, gdata->shares, share, tmpshare) {
|
||||
if (share->submit_time < now - 120) {
|
||||
HASH_DEL(gdata->shares, share);
|
||||
free(share);
|
||||
}
|
||||
}
|
||||
mutex_unlock(&gdata->share_lock);
|
||||
@ -2543,6 +2546,7 @@ static void *userproxy_recv(void *arg)
|
||||
HASH_ITER(hh, gdata->shares, share, tmpshare) {
|
||||
if (share->submit_time < now - 120) {
|
||||
HASH_DEL(gdata->shares, share);
|
||||
free(share);
|
||||
}
|
||||
}
|
||||
mutex_unlock(&gdata->share_lock);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user