Commit 16c8a21e authored by hpi1's avatar hpi1

Changed sound_free argument to SOUND_DATA **p Set SOUND_DATA pointer to NULL in sound_free()

parent d4c05899
......@@ -93,7 +93,7 @@ int main(int argc, const char *argv[])
_sound_print(data);
}
sound_free(data);
sound_free(&data);
}
return 0;
......
......@@ -105,16 +105,16 @@ static int _sound_read_samples(BITSTREAM *bs, SOUND_OBJECT *obj)
return 1;
}
void sound_free(SOUND_DATA *sounds)
void sound_free(SOUND_DATA **p)
{
if (sounds) {
if (p && *p) {
int i;
for (i = 0 ; i < sounds->num_sounds; i++) {
X_FREE(sounds->sounds[i].samples);
unsigned i;
for (i = 0 ; i < (*p)->num_sounds; i++) {
X_FREE((*p)->sounds[i].samples);
}
X_FREE(sounds);
X_FREE(*p);
}
}
......@@ -184,7 +184,7 @@ SOUND_DATA *sound_parse(const char *file_name)
return data;
error:
sound_free(data);
sound_free(&data);
X_FREE(data_offsets);
file_close(fp);
return NULL;
......
......@@ -40,6 +40,6 @@ typedef struct {
BD_PRIVATE SOUND_DATA* sound_parse(const char *path); /* parse sound.bdmv */
BD_PRIVATE void sound_free(SOUND_DATA *sound);
BD_PRIVATE void sound_free(SOUND_DATA **sound);
#endif // _MOBJ_PARSE_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment