Navigation Menu

Skip to content

Commit

Permalink
Allow freeing of NULL audio/video packets.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 11, 2011
1 parent 695a9de commit b7e21da
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions theoraplay.c
Expand Up @@ -530,9 +530,12 @@ const PcmAudioItem *THEORAPLAY_getAudio(THEORAPLAY_Decoder *decoder)
void THEORAPLAY_freeAudio(const PcmAudioItem *_item)
{
PcmAudioItem *item = (PcmAudioItem *) _item;
assert(item->next == NULL);
free(item->samples);
free(item);
if (item != NULL)
{
assert(item->next == NULL);
free(item->samples);
free(item);
} // if
} // THEORAPLAY_freeAudio


Expand Down Expand Up @@ -561,9 +564,12 @@ const YuvVideoItem *THEORAPLAY_getVideo(THEORAPLAY_Decoder *decoder)
void THEORAPLAY_freeVideo(const YuvVideoItem *_item)
{
YuvVideoItem *item = (YuvVideoItem *) _item;
assert(item->next == NULL);
free(item->yuv);
free(item);
if (item != NULL)
{
assert(item->next == NULL);
free(item->yuv);
free(item);
} // if
} // THEORAPLAY_freeVideo

// end of theoraplay.cpp ...
Expand Down

0 comments on commit b7e21da

Please sign in to comment.