Skip to content

Commit

Permalink
fix leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
lieff committed Oct 7, 2017
1 parent 367e90b commit fa33525
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/lvg.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ static void lvgDrawClipGroup(LVGMovieClip *clip, LVGMovieClipGroupState *groupst
LVGButtonState *bs = b->btn_shapes + j;
if (!(bs->flags & state_flags))
continue;
assert(LVG_OBJ_SHAPE == bs->obj.type || LVG_OBJ_GROUP == bs->obj.type || LVG_OBJ_BUTTON == bs->obj.type);
assert(LVG_OBJ_SHAPE == bs->obj.type || LVG_OBJ_GROUP == bs->obj.type || LVG_OBJ_BUTTON == bs->obj.type || LVG_OBJ_TEXT == bs->obj.type);
if (LVG_OBJ_SHAPE != bs->obj.type)
continue;
g_render->set_transform(g_render_obj, bs->obj.t, 0);
Expand Down Expand Up @@ -832,8 +832,12 @@ void lvgCloseClip(LVGMovieClip *clip)
}
for (j = 0; j < group->num_labels; j++)
free((void*)group->labels[j].name);
free(group->frames);
free(group->labels);
if (group->frames)
free(group->frames);
if (group->labels)
free(group->labels);
if (group->ssounds)
free(group->ssounds);
for (j = 0; j < sizeof(group->events)/sizeof(group->events[0]); j++)
if (group->events[j])
free(group->events[j]);
Expand Down
3 changes: 3 additions & 0 deletions swf/swf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,9 @@ static TAG *parsePlacements(TAG *firstTag, character_t *idtable, LVGMovieClip *c
}
tag = tag->next;
}
for (i = 0; i < 65536; i++)
if (placements[i].name)
free(placements[i].name);
free(placements);
assert(tag && ST_END == tag->id);
return tag;
Expand Down
4 changes: 2 additions & 2 deletions swf/swftools/lib/modules/swfobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ int swf_GetPlaceObject(TAG *tag, SWFPLACEOBJECT *obj, int version)
{
swf_ResetReadBits(tag);
int t = 0, l = strlen((const char *)&tag->data[tag->pos]);
U8 *data = (U8*)malloc(l+1);
U8 *data = (U8*)malloc(l + 1);
obj->name = (char*)data;
while((data[t++] = swf_GetU8(tag)));
while ((data[t++] = swf_GetU8(tag)));
}
if (flags & PF_CLIPDEPTH)
obj->clipdepth = swf_GetU16(tag);
Expand Down

0 comments on commit fa33525

Please sign in to comment.