dynamic_mod.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 17 Jun 2015 00:11:41 -0700
changeset 705 fe757163b8f7
parent 617 87116a42526e
child 711 f40c5ac95b12
permissions -rw-r--r--
Fixed bug 3018 - Loading MIDI music using FluidSynth leaks memory.

Philipp Wiesemann

There is a memory leak in fluidsynth.c and fluidsynth_loadsong_RW_internal(). The allocated temporary buffer is not deleted if fluid_player_add_mem() returns FLUID_OK.
slouken@419
     1
/*
slouken@518
     2
  SDL_mixer:  An audio mixer library based on the SDL library
slouken@601
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@419
     4
slouken@518
     5
  This software is provided 'as-is', without any express or implied
slouken@518
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@518
     7
  arising from the use of this software.
slouken@419
     8
slouken@518
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@518
    10
  including commercial applications, and to alter it and redistribute it
slouken@518
    11
  freely, subject to the following restrictions:
slouken@419
    12
slouken@518
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@518
    14
     claim that you wrote the original software. If you use this software
slouken@518
    15
     in a product, an acknowledgment in the product documentation would be
slouken@518
    16
     appreciated but is not required.
slouken@518
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@518
    18
     misrepresented as being the original software.
slouken@518
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@419
    20
*/
slouken@419
    21
slouken@419
    22
#ifdef MOD_MUSIC
slouken@419
    23
slouken@419
    24
#include "mikmod.h"
slouken@419
    25
slouken@419
    26
typedef struct {
slouken@617
    27
    int loaded;
slouken@617
    28
    void *handle;
slouken@419
    29
slouken@617
    30
    void (*MikMod_Exit)(void);
slouken@617
    31
    CHAR* (*MikMod_InfoDriver)(void);
slouken@617
    32
    CHAR* (*MikMod_InfoLoader)(void);
slouken@617
    33
    BOOL (*MikMod_Init)(CHAR*);
slouken@617
    34
    void (*MikMod_RegisterAllLoaders)(void);
slouken@617
    35
    void (*MikMod_RegisterDriver)(struct MDRIVER*);
slouken@617
    36
    int* MikMod_errno;
slouken@617
    37
    char* (*MikMod_strerror)(int);
slouken@617
    38
    void (*MikMod_free)(void*);
slouken@617
    39
    BOOL (*Player_Active)(void);
slouken@617
    40
    void (*Player_Free)(MODULE*);
slouken@617
    41
    MODULE* (*Player_LoadGeneric)(MREADER*,int,BOOL);
slouken@617
    42
    void (*Player_SetPosition)(UWORD);
slouken@617
    43
    void (*Player_SetVolume)(SWORD);
slouken@617
    44
    void (*Player_Start)(MODULE*);
slouken@617
    45
    void (*Player_Stop)(void);
slouken@617
    46
    ULONG (*VC_WriteBytes)(SBYTE*,ULONG);
slouken@617
    47
    struct MDRIVER* drv_nos;
slouken@617
    48
    UWORD* md_device;
slouken@617
    49
    UWORD* md_mixfreq;
slouken@617
    50
    UWORD* md_mode;
slouken@617
    51
    UBYTE* md_musicvolume;
slouken@617
    52
    UBYTE* md_pansep;
slouken@617
    53
    UBYTE* md_reverb;
slouken@617
    54
    UBYTE* md_sndfxvolume;
slouken@617
    55
    UBYTE* md_volume;
slouken@419
    56
} mikmod_loader;
slouken@419
    57
slouken@419
    58
extern mikmod_loader mikmod;
slouken@419
    59
slouken@470
    60
#endif /* MOD_MUSIC */
slouken@470
    61
slouken@419
    62
extern int Mix_InitMOD();
slouken@419
    63
extern void Mix_QuitMOD();