mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +00:00
- plugged the pending memory leaks.
This commit is contained in:
parent
5219916de5
commit
e84ec2978a
5 changed files with 15 additions and 24 deletions
|
@ -118,8 +118,12 @@ TimidityPPMIDIDevice::TimidityPPMIDIDevice(const char *args)
|
||||||
if (instruments != nullptr && !instruments->checkConfig(args))
|
if (instruments != nullptr && !instruments->checkConfig(args))
|
||||||
{
|
{
|
||||||
delete instruments;
|
delete instruments;
|
||||||
|
instruments = nullptr;
|
||||||
|
}
|
||||||
|
if (instruments == nullptr)
|
||||||
|
{
|
||||||
|
instruments = new TimidityPlus::Instruments;
|
||||||
}
|
}
|
||||||
instruments = new TimidityPlus::Instruments;
|
|
||||||
if (!instruments->load(args))
|
if (!instruments->load(args))
|
||||||
{
|
{
|
||||||
delete instruments;
|
delete instruments;
|
||||||
|
|
|
@ -1867,15 +1867,13 @@ Instrument *Instruments::play_midi_load_instrument(int dr, int bk, int prog, boo
|
||||||
void Instruments::init_userdrum()
|
void Instruments::init_userdrum()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
AlternateAssign *alt;
|
|
||||||
|
|
||||||
free_userdrum();
|
free_userdrum();
|
||||||
|
|
||||||
for (i = 0; i<2; i++) { /* allocate alternative assign */
|
for (i = 0; i<2; i++) { /* allocate alternative assign */
|
||||||
alt = (AlternateAssign *)safe_malloc(sizeof(AlternateAssign));
|
memset(&alt[i], 0, sizeof(AlternateAssign));
|
||||||
memset(alt, 0, sizeof(AlternateAssign));
|
|
||||||
alloc_instrument_bank(1, 64 + i);
|
alloc_instrument_bank(1, 64 + i);
|
||||||
drumset[64 + i]->alt = alt;
|
drumset[64 + i]->alt = &alt[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,6 +319,7 @@ class Instruments
|
||||||
UserDrumset *userdrum_first = (UserDrumset *)NULL;
|
UserDrumset *userdrum_first = (UserDrumset *)NULL;
|
||||||
UserDrumset *userdrum_last = (UserDrumset *)NULL;
|
UserDrumset *userdrum_last = (UserDrumset *)NULL;
|
||||||
|
|
||||||
|
AlternateAssign alt[2];
|
||||||
|
|
||||||
/* Some functions get aggravated if not even the standard banks are available. */
|
/* Some functions get aggravated if not even the standard banks are available. */
|
||||||
ToneBank
|
ToneBank
|
||||||
|
|
|
@ -5779,11 +5779,6 @@ struct midi_file_info *Player::new_midi_file_info()
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct midi_file_info *Player::get_midi_file_info(const char *filename, int newp)
|
|
||||||
{
|
|
||||||
return &midifileinfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5799,21 +5794,18 @@ void Player::playmidi_stream_init(void)
|
||||||
CLEAR_CHANNELMASK(channel_mute);
|
CLEAR_CHANNELMASK(channel_mute);
|
||||||
if (temper_type_mute & 1)
|
if (temper_type_mute & 1)
|
||||||
FILL_CHANNELMASK(channel_mute);
|
FILL_CHANNELMASK(channel_mute);
|
||||||
if(first)
|
if (first)
|
||||||
{
|
{
|
||||||
first = 0;
|
first = 0;
|
||||||
init_mblock(&playmidi_pool);
|
init_mblock(&playmidi_pool);
|
||||||
current_file_info = get_midi_file_info("TiMidity", 1);
|
midi_streaming = 1;
|
||||||
midi_streaming=1;
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
reuse_mblock(&playmidi_pool);
|
reuse_mblock(&playmidi_pool);
|
||||||
|
|
||||||
/* Fill in current_file_info */
|
/* Fill in current_file_info */
|
||||||
current_file_info = get_midi_file_info("", 0);
|
current_file_info = &midifileinfo;
|
||||||
current_file_info->readflag = 1;
|
current_file_info->readflag = 1;
|
||||||
current_file_info->seq_name = safe_strdup("TiMidity server");
|
|
||||||
current_file_info->karaoke_title = current_file_info->first_text = NULL;
|
|
||||||
current_file_info->hdrsiz = 0;
|
current_file_info->hdrsiz = 0;
|
||||||
current_file_info->format = 0;
|
current_file_info->format = 0;
|
||||||
current_file_info->tracks = 0;
|
current_file_info->tracks = 0;
|
||||||
|
|
|
@ -490,9 +490,6 @@ enum {
|
||||||
struct midi_file_info
|
struct midi_file_info
|
||||||
{
|
{
|
||||||
int readflag;
|
int readflag;
|
||||||
char *seq_name;
|
|
||||||
char *karaoke_title;
|
|
||||||
char *first_text;
|
|
||||||
int16_t hdrsiz;
|
int16_t hdrsiz;
|
||||||
int16_t format;
|
int16_t format;
|
||||||
int16_t tracks;
|
int16_t tracks;
|
||||||
|
@ -723,7 +720,6 @@ public:
|
||||||
|
|
||||||
void free_drum_effect(int);
|
void free_drum_effect(int);
|
||||||
void change_system_mode(int mode);
|
void change_system_mode(int mode);
|
||||||
struct midi_file_info *get_midi_file_info(const char *filename, int newp);
|
|
||||||
void recompute_freq(int v);
|
void recompute_freq(int v);
|
||||||
int get_default_mapID(int ch);
|
int get_default_mapID(int ch);
|
||||||
void init_channel_layer(int ch);
|
void init_channel_layer(int ch);
|
||||||
|
|
Loading…
Reference in a new issue