From 273294989e56fe80205562253e9d779c34660d2f Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Wed, 8 Feb 2006 16:38:56 +0000 Subject: [PATCH] Use benc_dget_mema instead of benc_dget_mem + malloc + bcopy. --- misc/metainfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/metainfo.c b/misc/metainfo.c index 589f03e..04b1cfc 100644 --- a/misc/metainfo.c +++ b/misc/metainfo.c @@ -157,11 +157,11 @@ fill_metainfo(const char *bep, struct metainfo *tp, int mem_hashes) tp->npieces = len / 20; tp->pieces_off = hash_addr - base_addr; if (mem_hashes) { - if ((tp->piece_hash = malloc(len)) == NULL) { + tp->piece_hash = (uint8_t (*)[20])benc_dget_mema(bep, "pieces", NULL); + if (tp->piece_hash == NULL) { err = ENOMEM; goto out; } - bcopy(hash_addr, tp->piece_hash, len); } tp->name = benc_dget_str(bep, "name", NULL);