fix: flipped calloc args

master
Sean McBride 3 years ago
parent 2c64f7ed41
commit d1009f4987

@ -273,9 +273,8 @@ priority_queue_initialize(size_t capacity, bool use_lock, priority_queue_get_pri
/* Add one to capacity because this data structure ignores the element at 0 */
size_t one_based_capacity = capacity + 1;
struct priority_queue *priority_queue = (struct priority_queue *)calloc(sizeof(struct priority_queue)
+ sizeof(void *) * one_based_capacity,
1);
struct priority_queue *priority_queue = (struct priority_queue *)
calloc(1, sizeof(struct priority_queue) + sizeof(void *) * one_based_capacity);
/* We're assuming a min-heap implementation, so set to larget possible value */

@ -168,7 +168,7 @@ sledge_abi__wasi_snapshot_preview1_args_get(__wasi_size_t argv_retoffset, __wasi
/* args_get backings return a vector of host pointers. We need a host buffer to store this
* temporarily before unswizzling and writing to linear memory */
char **argv_temp = calloc(sizeof(char *), argc);
char **argv_temp = calloc(argc, sizeof(char *));
if (unlikely(argv_temp == NULL)) { goto done; }
/* Writes argv_buf to linear memory and argv vector to our temporary buffer */
@ -284,7 +284,7 @@ sledge_abi__wasi_snapshot_preview1_environ_get(__wasi_size_t env_retoffset, __wa
* these results to environ_temp temporarily before converting to offsets and writing to
* linear memory. We could technically write this to linear memory and then do a "fix up,"
* but this would leak host information and constitue a security issue */
char **env_temp = calloc(sizeof(char *), envc);
char **env_temp = calloc(envc, sizeof(char *));
if (unlikely(env_temp == NULL)) { goto done; }
__wasi_size_t *env_retptr = (__wasi_size_t *)get_memory_ptr_for_runtime(env_retoffset,

Loading…
Cancel
Save