summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-09-22 18:16:10 +0000
committerMiles Bader <miles@gnu.org>1997-09-22 18:16:10 +0000
commit301caa4ff472854973935d2af4f2f974430632d7 (patch)
treece3323e7b0b1f5516679ac311b928d1f473fc34f
parentd557191eb5cb68560d67adc381412cc759f970ce (diff)
(store_encode):
Allocate the correct amount of memory for the encoding vectors.
-rw-r--r--libstore/encode.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libstore/encode.c b/libstore/encode.c
index d8bbcd5f..f9896a9d 100644
--- a/libstore/encode.c
+++ b/libstore/encode.c
@@ -102,13 +102,16 @@ store_encode (const struct store *store, struct store_enc *enc)
if (enc->num_ports > init_num_ports)
err = vm_allocate (mach_task_self (),
- (vm_address_t *)&enc->ports, enc->num_ports, 1);
+ (vm_address_t *)&enc->ports,
+ enc->num_ports * sizeof *enc->ports, 1);
if (!err && enc->num_ints > init_num_ints)
err = vm_allocate (mach_task_self (),
- (vm_address_t *)&enc->ints, enc->num_ints, 1);
+ (vm_address_t *)&enc->ints,
+ enc->num_ints * sizeof *enc->ints, 1);
if (!err && enc->num_offsets > init_num_offsets)
err = vm_allocate (mach_task_self (),
- (vm_address_t *)&enc->offsets, enc->num_offsets, 1);
+ (vm_address_t *)&enc->offsets,
+ enc->num_offsets * sizeof *enc->offsets, 1);
if (!err && enc->data_len > init_data_len)
err = vm_allocate (mach_task_self (),
(vm_address_t *)&enc->data, enc->data_len, 1);