[-] Lots of housekeeping thanks to scan-build and input from @acmay

This commit is contained in:
ejurgensen
2016-11-19 23:08:50 +01:00
parent 8525c278ec
commit bdd6bab982
21 changed files with 159 additions and 81 deletions

View File

@@ -170,10 +170,17 @@ alsa_session_make(struct output_device *device, output_status_cb cb)
struct alsa_session *as;
os = calloc(1, sizeof(struct output_session));
as = calloc(1, sizeof(struct alsa_session));
if (!os || !as)
if (!os)
{
DPRINTF(E_LOG, L_LAUDIO, "Out of memory for ALSA session\n");
DPRINTF(E_LOG, L_LAUDIO, "Out of memory for ALSA session (os)\n");
return NULL;
}
as = calloc(1, sizeof(struct alsa_session));
if (!as)
{
DPRINTF(E_LOG, L_LAUDIO, "Out of memory for ALSA session (as)\n");
free(os);
return NULL;
}

View File

@@ -1323,10 +1323,17 @@ cast_session_make(struct output_device *device, int family, output_status_cb cb)
}
os = calloc(1, sizeof(struct output_session));
cs = calloc(1, sizeof(struct cast_session));
if (!os || !cs)
if (!os)
{
DPRINTF(E_LOG, L_CAST, "Out of memory for TLS session\n");
DPRINTF(E_LOG, L_CAST, "Out of memory (os)\n");
return NULL;
}
cs = calloc(1, sizeof(struct cast_session));
if (!cs)
{
DPRINTF(E_LOG, L_CAST, "Out of memory (cs)\n");
free(os);
return NULL;
}

View File

@@ -91,10 +91,17 @@ dummy_session_make(struct output_device *device, output_status_cb cb)
struct dummy_session *ds;
os = calloc(1, sizeof(struct output_session));
ds = calloc(1, sizeof(struct dummy_session));
if (!os || !ds)
if (!os)
{
DPRINTF(E_LOG, L_LAUDIO, "Out of memory for dummy session\n");
DPRINTF(E_LOG, L_LAUDIO, "Out of memory for dummy session (os)\n");
return NULL;
}
ds = calloc(1, sizeof(struct dummy_session));
if (!ds)
{
DPRINTF(E_LOG, L_LAUDIO, "Out of memory for dummy session (as)\n");
free(os);
return NULL;
}

View File

@@ -221,10 +221,17 @@ fifo_session_make(struct output_device *device, output_status_cb cb)
struct fifo_session *fifo_session;
output_session = calloc(1, sizeof(struct output_session));
fifo_session = calloc(1, sizeof(struct fifo_session));
if (!output_session || !fifo_session)
if (!output_session)
{
DPRINTF(E_LOG, L_FIFO, "Out of memory for fifo session\n");
DPRINTF(E_LOG, L_FIFO, "Out of memory (os)\n");
return NULL;
}
fifo_session = calloc(1, sizeof(struct fifo_session));
if (!fifo_session)
{
DPRINTF(E_LOG, L_FIFO, "Out of memory (fs)\n");
free(output_session);
return NULL;
}

View File

@@ -146,10 +146,17 @@ pulse_session_make(struct output_device *device, output_status_cb cb)
struct pulse_session *ps;
os = calloc(1, sizeof(struct output_session));
ps = calloc(1, sizeof(struct pulse_session));
if (!os || !ps)
if (!os)
{
DPRINTF(E_LOG, L_LAUDIO, "Out of memory for Pulseaudio session\n");
DPRINTF(E_LOG, L_LAUDIO, "Out of memory (os)\n");
return NULL;
}
ps = calloc(1, sizeof(struct pulse_session));
if (!ps)
{
DPRINTF(E_LOG, L_LAUDIO, "Out of memory (ps)\n");
free(os);
return NULL;
}

View File

@@ -1885,10 +1885,17 @@ raop_session_make(struct output_device *rd, int family, output_status_cb cb)
}
os = calloc(1, sizeof(struct output_session));
rs = calloc(1, sizeof(struct raop_session));
if (!os || !rs)
if (!os)
{
DPRINTF(E_LOG, L_RAOP, "Out of memory for RAOP session\n");
DPRINTF(E_LOG, L_RAOP, "Out of memory (os)\n");
return NULL;
}
rs = calloc(1, sizeof(struct raop_session));
if (!rs)
{
DPRINTF(E_LOG, L_RAOP, "Out of memory (rs)\n");
free(os);
return NULL;
}
@@ -4034,10 +4041,18 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
DPRINTF(E_DBG, L_RAOP, "Event for AirPlay device %s (port %d, id %" PRIx64 ")\n", at_name, port, id);
rd = calloc(1, sizeof(struct output_device));
re = calloc(1, sizeof(struct raop_extra));
if (!rd || !re)
if (!rd)
{
DPRINTF(E_LOG, L_RAOP, "Out of memory for new AirPlay device\n");
DPRINTF(E_LOG, L_RAOP, "Out of memory (rd)\n");
return;
}
re = calloc(1, sizeof(struct raop_extra));
if (!re)
{
DPRINTF(E_LOG, L_RAOP, "Out of memory (re)\n");
free(rd);
return;
}