diff options
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/cli-command.c | 3 | ||||
-rw-r--r-- | src/pulsecore/core-util.c | 4 | ||||
-rw-r--r-- | src/pulsecore/hashmap.c | 2 | ||||
-rw-r--r-- | src/pulsecore/log.c | 1 | ||||
-rw-r--r-- | src/pulsecore/protocol-esound.c | 2 | ||||
-rw-r--r-- | src/pulsecore/protocol-native.c | 30 |
6 files changed, 27 insertions, 15 deletions
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index 1df0bd63..5e45c1aa 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -401,7 +401,6 @@ static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b } static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { - pa_module *m; const char *name; pa_core_assert_ref(c); @@ -414,7 +413,7 @@ static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b return -1; } - if (!(m = pa_module_load(c, name, pa_tokenizer_get(t, 2)))) { + if (!pa_module_load(c, name, pa_tokenizer_get(t, 2))) { pa_strbuf_puts(buf, "Module load failed.\n"); return -1; } diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 61f9a656..a184bebd 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -1411,6 +1411,7 @@ static int make_random_dir_and_link(mode_t m, const char *k) { return -1; } + pa_xfree(p); return 0; } @@ -1443,6 +1444,7 @@ char *pa_get_runtime_dir(void) { if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1) < 0) { pa_log_error("Failed to create secure directory: %s", pa_cstrerror(errno)); + pa_xfree(d); goto fail; } @@ -2459,7 +2461,7 @@ char *pa_machine_id(void) { pa_strip_nl(ln); - if (ln[0]) + if (r && ln[0]) return pa_xstrdup(ln); } diff --git a/src/pulsecore/hashmap.c b/src/pulsecore/hashmap.c index 3c6f41ec..57607b69 100644 --- a/src/pulsecore/hashmap.c +++ b/src/pulsecore/hashmap.c @@ -138,7 +138,7 @@ int pa_hashmap_put(pa_hashmap *h, const void *key, void *value) { hash = h->hash_func(key) % NBUCKETS; - if ((e = hash_scan(h, hash, key))) + if (hash_scan(h, hash, key)) return -1; if (!(e = pa_flist_pop(PA_STATIC_FLIST_GET(entries)))) diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c index 1ae43839..89b75da3 100644 --- a/src/pulsecore/log.c +++ b/src/pulsecore/log.c @@ -351,6 +351,7 @@ void pa_log_levelv_meta( } errno = saved_errno; + pa_xfree(bt); } void pa_log_level_meta( diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c index e1643cbb..840f4581 100644 --- a/src/pulsecore/protocol-esound.c +++ b/src/pulsecore/protocol-esound.c @@ -924,7 +924,7 @@ static int do_read(connection *c) { c->request = PA_MAYBE_INT32_SWAP(c->swap_byte_order, c->request); - if (c->request < ESD_PROTO_CONNECT || c->request > ESD_PROTO_MAX) { + if (c->request < ESD_PROTO_CONNECT || c->request >= ESD_PROTO_MAX) { pa_log("recieved invalid request."); return -1; } diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 79b9b069..a963f78a 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -2560,7 +2560,10 @@ static void command_create_upload_stream(pa_pdispatch *pd, uint32_t command, uin if (!(name = pa_proplist_gets(p, PA_PROP_EVENT_ID))) name = pa_proplist_gets(p, PA_PROP_MEDIA_NAME); - CHECK_VALIDITY(c->pstream, name && pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID); + if (!name || !pa_namereg_is_valid_name(name)) { + pa_proplist_free(p); + CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_INVALID); + } s = upload_stream_new(c, &ss, &map, name, length, p); pa_proplist_free(p); @@ -3011,7 +3014,7 @@ static void command_get_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, p source_fill_tagstruct(c, reply, source); else if (client) client_fill_tagstruct(c, reply, client); - else if (client) + else if (card) card_fill_tagstruct(c, reply, card); else if (module) module_fill_tagstruct(c, reply, module); @@ -3590,24 +3593,30 @@ static void command_update_proplist(pa_pdispatch *pd, uint32_t command, uint32_t } } - CHECK_VALIDITY(c->pstream, mode == PA_UPDATE_SET || mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE, tag, PA_ERR_INVALID); + if (!(mode == PA_UPDATE_SET || mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE)) { + pa_proplist_free(p); + CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_INVALID); + } if (command == PA_COMMAND_UPDATE_PLAYBACK_STREAM_PROPLIST) { playback_stream *s; s = pa_idxset_get_by_index(c->output_streams, idx); - CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY); - CHECK_VALIDITY(c->pstream, playback_stream_isinstance(s), tag, PA_ERR_NOENTITY); - + if (!s || !playback_stream_isinstance(s)) { + pa_proplist_free(p); + CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_NOENTITY); + } pa_sink_input_update_proplist(s->sink_input, mode, p); } else if (command == PA_COMMAND_UPDATE_RECORD_STREAM_PROPLIST) { record_stream *s; - s = pa_idxset_get_by_index(c->record_streams, idx); - CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY); - + if (!(s = pa_idxset_get_by_index(c->record_streams, idx))) { + pa_proplist_free(p); + CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_NOENTITY); + } pa_source_output_update_proplist(s->source_output, mode, p); + } else { pa_assert(command == PA_COMMAND_UPDATE_CLIENT_PROPLIST); @@ -3615,6 +3624,7 @@ static void command_update_proplist(pa_pdispatch *pd, uint32_t command, uint32_t } pa_pstream_send_simple_ack(c->pstream, tag); + pa_proplist_free(p); } static void command_remove_proplist(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { @@ -4070,7 +4080,7 @@ static void command_extension(pa_pdispatch *pd, uint32_t command, uint32_t tag, CHECK_VALIDITY(c->pstream, m->load_once || idx != PA_INVALID_INDEX, tag, PA_ERR_INVALID); cb = (pa_native_protocol_ext_cb_t) (unsigned long) pa_hashmap_get(c->protocol->extensions, m); - CHECK_VALIDITY(c->pstream, m, tag, PA_ERR_NOEXTENSION); + CHECK_VALIDITY(c->pstream, cb, tag, PA_ERR_NOEXTENSION); if (cb(c->protocol, m, c, tag, t) < 0) protocol_error(c); |