about summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2006-02-06 20:43:56 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2006-02-06 20:43:56 +0000
commit36a68e4b76688937010eeed1695d6da3ce8c2fc5 (patch)
treeaee6fe7b394b78c8c747f8d78c8f420f5e533eb0 /misc
parentaf64140b1f8e2428e363bdc51e57153f0efb8be5 (diff)
downloadbtpd-36a68e4b76688937010eeed1695d6da3ce8c2fc5.tar.gz
btpd-36a68e4b76688937010eeed1695d6da3ce8c2fc5.zip
Check for failure to allocate memory.
Diffstat (limited to 'misc')
-rw-r--r--misc/metainfo.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/misc/metainfo.c b/misc/metainfo.c
index d8f3a7c..589f03e 100644
--- a/misc/metainfo.c
+++ b/misc/metainfo.c
@@ -69,7 +69,6 @@ check_path(const char *path, size_t len)
 int
 fill_fileinfo(const char *fdct, struct fileinfo *tfp)
 {
-    //int err;
     size_t npath, plen, len;
     const char *plst, *iter, *str;
 
@@ -147,7 +146,10 @@ fill_metainfo(const char *bep, struct metainfo *tp, int mem_hashes)
             BE_STR, 2, "info", "name"))
         return EINVAL;
 
-    tp->announce = benc_dget_str(bep, "announce", NULL);
+    if ((tp->announce = benc_dget_str(bep, "announce", NULL)) == NULL) {
+        err = ENOMEM;
+        goto out;
+    }
     bep = benc_dget_dct(bep, "info");
     SHA1(bep, benc_length(bep), tp->info_hash);
     tp->piece_length = benc_dget_int(bep, "piece length");