Fix calculation of sizeof boxed ivec of str in rt. Closes #712

This commit is contained in:
Brian Anderson
2011-07-19 16:55:09 -07:00
parent 19a17b3d1d
commit 652214d7f9
3 changed files with 15 additions and 2 deletions

View File

@@ -608,8 +608,12 @@ rust_list_files_ivec(rust_task *task, rust_str *path) {
closedir(dirp);
}
#endif
size_t str_ivec_sz =
sizeof(size_t) // fill
+ sizeof(size_t) // alloc
+ sizeof(rust_str *) * 4; // payload
rust_box *box = (rust_box *)task->malloc(sizeof(rust_box) +
sizeof(rust_ivec));
str_ivec_sz);
box->ref_count = 1;
rust_ivec *iv = (rust_ivec *)&box->data;
iv->fill = 0;