Skip to content

Commit

Permalink
Fix a crash in clone_free (invalid free).
Browse files Browse the repository at this point in the history
This fixes some fallout from the multi-channel backport in
rev. e745bc9, by replacing some faulty code in clone_free with the
correct code from vanilla Pd.
  • Loading branch information
agraef committed Oct 18, 2024
1 parent b4da86a commit 73c5b8d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pd/src/g_clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,17 +645,16 @@ static void clone_free(t_clone *x)
int i;
for (i = 0; i < x->x_n; i++)
{
canvas_closebang(x->x_vec[i].c_gl);
#if 1 // ag: what's this for? on probation for now
if(x->x_vec[i].c_gl->gl_isab)
{
/* crude hack. since clones don't have owner,
we set it manually to allow the clone to
deregister the dependencies */
x->x_vec[i].c_gl->gl_owner = x->x_canvas;
}
pd_free(&x->x_vec[i].c_gl->gl_pd);
t_freebytes(&x->x_outvec[i],
x->x_nout * sizeof(x->x_outvec[i]));
#endif
clone_freeinstance(x, i);
}
t_freebytes(x->x_vec, x->x_n * sizeof(*x->x_vec));
t_freebytes(x->x_argv, x->x_argc * sizeof(*x->x_argv));
Expand Down

0 comments on commit 73c5b8d

Please sign in to comment.