Skip to content

Commit

Permalink
Fix leak in join; missing free on early return.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jan 17, 2015
1 parent 1ac4eec commit f74cd19
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/strings/ops.c
Expand Up @@ -877,8 +877,10 @@ MVMString * MVM_string_join(MVMThreadContext *tc, MVMString *separator, MVMObjec
}

/* We now know the total eventual number of graphemes. */
if (total_graphs == 0)
if (total_graphs == 0) {
free(pieces);
return tc->instance->str_consts.empty;
}
result->body.num_graphs = total_graphs;

/* If we just collect all the things as strands, are we within bounds, and
Expand Down

0 comments on commit f74cd19

Please sign in to comment.