Skip to content

Commit

Permalink
Make sure VMArray's copy_to doesn't try to allocate zero bytes.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnsholt committed Mar 25, 2013
1 parent 3bcd78a commit 8cf46f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/6model/reprs/VMArray.c
Expand Up @@ -227,8 +227,9 @@ static void copy_to(PARROT_INTERP, STable *st, void *src, void *dest) {
dest_body->elems = src_body->elems;
dest_body->start = src_body->start;
dest_body->ssize = src_body->ssize;
dest_body->slots = mem_sys_allocate(bytes);
memcpy(dest_body->slots, src_body->slots, bytes);
dest_body->slots = bytes? mem_sys_allocate(bytes) : NULL;
if(bytes)
memcpy(dest_body->slots, src_body->slots, bytes);
}

static void serialize(PARROT_INTERP, STable *st, void *data, SerializationWriter *writer) {
Expand Down

0 comments on commit 8cf46f5

Please sign in to comment.