summaryrefslogtreecommitdiffstats
path: root/src/jv_aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jv_aux.c')
-rw-r--r--src/jv_aux.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/jv_aux.c b/src/jv_aux.c
index db2e0ef8..129cd043 100644
--- a/src/jv_aux.c
+++ b/src/jv_aux.c
@@ -465,7 +465,7 @@ jv jv_keys_unsorted(jv x) {
jv jv_keys(jv x) {
if (jv_get_kind(x) == JV_KIND_OBJECT) {
int nkeys = jv_object_length(jv_copy(x));
- jv* keys = jv_mem_alloc(sizeof(jv) * nkeys);
+ jv* keys = jv_mem_calloc(sizeof(jv), nkeys);
int kidx = 0;
jv_object_foreach(x, key, value) {
keys[kidx++] = key;
@@ -587,7 +587,7 @@ static struct sort_entry* sort_items(jv objects, jv keys) {
assert(jv_get_kind(keys) == JV_KIND_ARRAY);
assert(jv_array_length(jv_copy(objects)) == jv_array_length(jv_copy(keys)));
int n = jv_array_length(jv_copy(objects));
- struct sort_entry* entries = jv_mem_alloc(sizeof(struct sort_entry) * n);
+ struct sort_entry* entries = jv_mem_calloc(sizeof(struct sort_entry), n);
for (int i=0; i<n; i++) {
entries[i].object = jv_array_get(jv_copy(objects), i);
entries[i].key = jv_array_get(jv_copy(keys), i);