summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-11-11 20:55:09 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-11-11 21:30:40 +0100
commitdfacef3019e560159601c80745f2b88919f65d27 (patch)
tree14fd54c01bf3ba26076c71f3ca09e6f77bbdc5fb /plugins
parent679daf9907e3ae8bba66fe8a2e5f57a2987130f4 (diff)
fixed few errors reported by cppcheck (thanks to Pavel Roschin)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ao/plugin.c1
-rw-r--r--plugins/dumb/dumb-kode54/src/it/readptm.c3
-rw-r--r--plugins/dumb/dumb-kode54/src/it/readxm.c1
-rw-r--r--plugins/mms/libmms/uri.c9
-rw-r--r--plugins/shellexec/shellexec.c2
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i11
-rw-r--r--plugins/vtx/vtxfile.c15
-rw-r--r--plugins/wildmidi/src/wildmidi_lib.c11
8 files changed, 36 insertions, 17 deletions
diff --git a/plugins/ao/plugin.c b/plugins/ao/plugin.c
index d997c759..7964c311 100644
--- a/plugins/ao/plugin.c
+++ b/plugins/ao/plugin.c
@@ -228,6 +228,7 @@ aoplug_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
if (deadbeef->fread(buffer, 1, size, fp) != size) {
deadbeef->fclose (fp);
+ free (buffer);
fprintf(stderr, "psf: file read error: %s\n", fname);
return NULL;
}
diff --git a/plugins/dumb/dumb-kode54/src/it/readptm.c b/plugins/dumb/dumb-kode54/src/it/readptm.c
index cae73edf..7e9801fe 100644
--- a/plugins/dumb/dumb-kode54/src/it/readptm.c
+++ b/plugins/dumb/dumb-kode54/src/it/readptm.c
@@ -457,6 +457,7 @@ static DUMB_IT_SIGDATA *it_ptm_load_sigdata(DUMBFILE *f)
if (it_seek(f, 352)) {
_dumb_it_unload_sigdata(sigdata);
+ free (component);
return NULL;
}
@@ -468,12 +469,14 @@ static DUMB_IT_SIGDATA *it_ptm_load_sigdata(DUMBFILE *f)
}
if (it_seek(f, 608)) {
+ free (component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (n = 0; n < sigdata->n_samples; n++) {
if (it_ptm_read_sample_header(&sigdata->sample[n], &component[n_components].offset, f)) {
+ free (component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
diff --git a/plugins/dumb/dumb-kode54/src/it/readxm.c b/plugins/dumb/dumb-kode54/src/it/readxm.c
index 7ceed801..74bf02dd 100644
--- a/plugins/dumb/dumb-kode54/src/it/readxm.c
+++ b/plugins/dumb/dumb-kode54/src/it/readxm.c
@@ -907,6 +907,7 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f, int * version)
sigdata->instrument = malloc(sigdata->n_instruments * sizeof(*sigdata->instrument));
if (!sigdata->instrument) {
+ free (roguebytes);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
diff --git a/plugins/mms/libmms/uri.c b/plugins/mms/libmms/uri.c
index 111ca128..38bb8dba 100644
--- a/plugins/mms/libmms/uri.c
+++ b/plugins/mms/libmms/uri.c
@@ -144,11 +144,16 @@ static int split_user_passwd(const char* in, char** user, char** passwd)
*((*passwd)++) = '\0'; // don't you love C? :)
*user = strdup(tmp);
- if(!*user)
+ if(!*user) {
+ free (tmp);
return 0;
+ }
*passwd = strdup(*passwd);
- if(!*passwd)
+ if(!*passwd) {
+ free (tmp);
+ free (*user);
return 0;
+ }
free(tmp);
return 1;
diff --git a/plugins/shellexec/shellexec.c b/plugins/shellexec/shellexec.c
index 56ceb970..99bb4715 100644
--- a/plugins/shellexec/shellexec.c
+++ b/plugins/shellexec/shellexec.c
@@ -106,7 +106,7 @@ shx_callback (Shx_action_t *action, int ctx)
deadbeef->pl_lock ();
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
if (plt) {
- DB_playItem_t **items;
+ DB_playItem_t **items = NULL;
int items_count = deadbeef->plt_getselcount (plt);
if (0 < items_count) {
items = malloc (sizeof (DB_playItem_t *) * items_count);
diff --git a/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i
index c1aa0559..646da760 100644
--- a/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i
@@ -131,6 +131,7 @@ const char _sidtune_CHRtab[256] = // CHR$ conversion table (0x01 = no output)
*/
#include "config.h"
+#include <string.h>
#ifdef HAVE_EXCEPTIONS
# include <new>
@@ -2559,9 +2560,9 @@ void MOS6510::reset (void)
// Module Credits //
void MOS6510::credits (char *sbuffer)
{ // Copy credits to buffer
- sprintf (sbuffer, "%sModule : MOS6510 Cycle Exact Emulation\n", sbuffer);
- sprintf (sbuffer, "%sWritten By : %s\n", sbuffer, MOS6510_AUTHOR);
- sprintf (sbuffer, "%sVersion : %s\n", sbuffer, MOS6510_VERSION);
- sprintf (sbuffer, "%sReleased : %s\n", sbuffer, MOS6510_DATE);
- sprintf (sbuffer, "%sEmail : %s\n", sbuffer, MOS6510_EMAIL);
+ strcat (sbuffer, "Module : MOS6510 Cycle Exact Emulation\n"
+ "Written By : " MOS6510_AUTHOR "\n"
+ "Version : " MOS6510_VERSION "\n"
+ "Released : " MOS6510_DATE "\n"
+ "Email : " MOS6510_EMAIL "\n");
}
diff --git a/plugins/vtx/vtxfile.c b/plugins/vtx/vtxfile.c
index 9dbeb9f7..ff9914e6 100644
--- a/plugins/vtx/vtxfile.c
+++ b/plugins/vtx/vtxfile.c
@@ -192,12 +192,15 @@ void ayemu_vtx_free(ayemu_vtx_t *vtx)
{
#define FREE_PTR(x) if (x) { free(x); x = NULL; }
- FREE_PTR(vtx->title);
- FREE_PTR(vtx->author);
- FREE_PTR(vtx->from);
- FREE_PTR(vtx->tracker);
- FREE_PTR(vtx->comment);
- FREE_PTR(vtx->regdata);
+ if (vtx) {
+ FREE_PTR(vtx->title);
+ FREE_PTR(vtx->author);
+ FREE_PTR(vtx->from);
+ FREE_PTR(vtx->tracker);
+ FREE_PTR(vtx->comment);
+ FREE_PTR(vtx->regdata);
+ free (vtx);
+ }
}
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;