diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-11-11 20:55:09 +0100 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-11-11 21:30:40 +0100 |
commit | dfacef3019e560159601c80745f2b88919f65d27 (patch) | |
tree | 14fd54c01bf3ba26076c71f3ca09e6f77bbdc5fb /plugins/wildmidi | |
parent | 679daf9907e3ae8bba66fe8a2e5f57a2987130f4 (diff) |
fixed few errors reported by cppcheck (thanks to Pavel Roschin)
Diffstat (limited to 'plugins/wildmidi')
-rw-r--r-- | plugins/wildmidi/src/wildmidi_lib.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/wildmidi/src/wildmidi_lib.c b/plugins/wildmidi/src/wildmidi_lib.c index 892ea3c4..26bf72ac 100644 --- a/plugins/wildmidi/src/wildmidi_lib.c +++ b/plugins/wildmidi/src/wildmidi_lib.c @@ -748,15 +748,19 @@ WM_LoadConfig (const char *config_file, const char *top_config_dir) { char * new_config = NULL; struct _patch * tmp_patch; + if ((config_buffer = WM_BufferFile(config_file, &config_size)) == NULL) { + return -1; + } + if (top_config_dir) { config_dir = strdup (top_config_dir); } - if ((config_buffer = WM_BufferFile(config_file, &config_size)) == NULL) { - return -1; - } if (config_buffer == NULL) { WM_FreePatches(); + if (config_dir) { + free (config_dir); + } return -1; } @@ -3496,6 +3500,7 @@ WM_ParseNewMidi(unsigned char *mididata, unsigned long int midisize ) { first_handle = malloc(sizeof(struct _hndl)); if (first_handle == NULL) { WM_ERROR(__FUNCTION__, __LINE__, WM_ERR_MEM," to parse midi data", errno); + free (tmp_trackdata); free(mdi->data); free(mdi); return NULL; |