]> git.lizzy.rs Git - rust.git/commitdiff
fix valgrind error: allocate enough space for all type descs
authorNiko Matsakis <niko@alum.mit.edu>
Sat, 7 Jan 2012 16:03:34 +0000 (08:03 -0800)
committerNiko Matsakis <niko@alum.mit.edu>
Sat, 7 Jan 2012 16:03:34 +0000 (08:03 -0800)
src/rt/rust_upcall.cpp

index 2b104548f904b9fdec89f94b6f14c19629911044..423287e017ee4e1268c39bc3534e8dff90a5560b 100644 (file)
@@ -247,7 +247,7 @@ void upcall_s_create_shared_type_desc(s_create_shared_type_desc_args *args)
     // Copy the main part of the type descriptor:
     const type_desc *td = args->td;
     int n_params = td->n_params;
-    size_t sz = sizeof(type_desc) + sizeof(type_desc*) * n_params;
+    size_t sz = sizeof(type_desc) + sizeof(type_desc*) * (n_params+1);
     args->res = (type_desc*) task->kernel->malloc(sz, "create_shared_type_desc");
     memcpy(args->res, td, sizeof(type_desc));