dynamic_modplug.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 17 Jun 2015 00:11:41 -0700
changeset 705 fe757163b8f7
parent 695 6a5e6d8d6a35
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@639
     1
/*
slouken@639
     2
  SDL_mixer:  An audio mixer library based on the SDL library
slouken@639
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@639
     4
slouken@639
     5
  This software is provided 'as-is', without any express or implied
slouken@639
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@639
     7
  arising from the use of this software.
slouken@639
     8
slouken@639
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@639
    10
  including commercial applications, and to alter it and redistribute it
slouken@639
    11
  freely, subject to the following restrictions:
slouken@639
    12
slouken@639
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@639
    14
     claim that you wrote the original software. If you use this software
slouken@639
    15
     in a product, an acknowledgment in the product documentation would be
slouken@639
    16
     appreciated but is not required.
slouken@639
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@639
    18
     misrepresented as being the original software.
slouken@639
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@639
    20
*/
slouken@639
    21
slouken@639
    22
#ifdef MODPLUG_MUSIC
slouken@639
    23
slouken@695
    24
#ifdef MODPLUG_HEADER
slouken@695
    25
#include MODPLUG_HEADER
slouken@695
    26
#else
slouken@695
    27
#include <libmodplug/modplug.h>
slouken@695
    28
#endif
slouken@639
    29
slouken@639
    30
typedef struct {
slouken@639
    31
    int loaded;
slouken@639
    32
    void *handle;
slouken@639
    33
slouken@639
    34
    ModPlugFile* (*ModPlug_Load)(const void* data, int size);
slouken@639
    35
    void (*ModPlug_Unload)(ModPlugFile* file);
slouken@639
    36
    int  (*ModPlug_Read)(ModPlugFile* file, void* buffer, int size);
slouken@639
    37
    void (*ModPlug_Seek)(ModPlugFile* file, int millisecond);
slouken@639
    38
    void (*ModPlug_GetSettings)(ModPlug_Settings* settings);
slouken@639
    39
    void (*ModPlug_SetSettings)(const ModPlug_Settings* settings);
slouken@639
    40
    void (*ModPlug_SetMasterVolume)(ModPlugFile* file,unsigned int cvol) ;
slouken@639
    41
} modplug_loader;
slouken@639
    42
slouken@639
    43
extern modplug_loader modplug;
slouken@639
    44
slouken@639
    45
#endif /* MODPLUG_MUSIC */
slouken@639
    46
slouken@639
    47
extern int Mix_InitModPlug();
slouken@639
    48
extern void Mix_QuitModPlug();