Browse Source

Use benc_dget_mema instead of benc_dget_mem + malloc + bcopy.

master
Richard Nyberg 19 years ago
parent
commit
273294989e
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      misc/metainfo.c

+ 2
- 2
misc/metainfo.c View File

@@ -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);



Loading…
Cancel
Save