commit b58f398bec3b6da03538fb6e7b38fea63e405642
parent 746ca051ad4204f4e38aeba12e06652fa525d387
Author: sin <sin@2f30.org>
Date: Mon, 21 Dec 2015 20:15:35 +0000
Free early
Diffstat:
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/tracker.c b/tracker.c
@@ -22,6 +22,9 @@ tracker_get_peers(struct torrent *t, struct ben **reply)
"GET /%s?info_hash=%s&peer_id=%s&port=6881&uploaded=0&"
"downloaded=0&left=%zu&event=started HTTP/1.1\r\n\r\n",
path, infohash, id, t->files[0].len);
+ free(id);
+ free(infohash);
+ free(url);
if (r < 0 || (size_t)r >= sizeof(buf))
goto err0;
@@ -46,13 +49,7 @@ tracker_get_peers(struct torrent *t, struct ben **reply)
goto err0;
bprint(*reply, 0);
- free(url);
- free(infohash);
- free(id);
return 0;
err0:
- free(url);
- free(infohash);
- free(id);
return -1;
}