dynamic_ogg.h
author Sam Lantinga <slouken@libsdl.org>
Tue, 21 May 2013 21:09:26 -0700
changeset 616 7ead8213dfb0
parent 613 6fa075aa693e
child 617 87116a42526e
permissions -rw-r--r--
Fixed bug 1833 - Memory leak issue in SDL_mixer-1.2.12/music.c file

Nitz

In this code 'music' is dynamically allocated. But memory get leaked at return MUS_NONE.
     1 /*
     2   SDL_mixer:  An audio mixer library based on the SDL library
     3   Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 #ifdef OGG_MUSIC
    23 #ifdef OGG_USE_TREMOR
    24 #include <tremor/ivorbisfile.h>
    25 #else
    26 #include <vorbis/vorbisfile.h>
    27 #endif
    28 
    29 typedef struct {
    30 	int loaded;
    31 	void *handle;
    32 	int (*ov_clear)(OggVorbis_File *vf);
    33 	vorbis_info *(*ov_info)(OggVorbis_File *vf,int link);
    34 	int (*ov_open_callbacks)(void *datasource, OggVorbis_File *vf, const char *initial, long ibytes, ov_callbacks callbacks);
    35 	ogg_int64_t (*ov_pcm_total)(OggVorbis_File *vf,int i);
    36 #ifdef OGG_USE_TREMOR
    37 	long (*ov_read)(OggVorbis_File *vf,char *buffer,int length, int *bitstream);
    38 #else
    39 	long (*ov_read)(OggVorbis_File *vf,char *buffer,int length, int bigendianp,int word,int sgned,int *bitstream);
    40 #endif
    41 #ifdef OGG_USE_TREMOR
    42 	int (*ov_time_seek)(OggVorbis_File *vf,ogg_int64_t pos);
    43 #else
    44 	int (*ov_time_seek)(OggVorbis_File *vf,double pos);
    45 #endif
    46 } vorbis_loader;
    47 
    48 extern vorbis_loader vorbis;
    49 
    50 #endif /* OGG_MUSIC */
    51 
    52 extern int Mix_InitOgg();
    53 extern void Mix_QuitOgg();