mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
Fix memory leaks
The returned string of the dbus_message_iter_get_signature() must be freed with dbus_free().
This commit is contained in:
parent
8b9a8b2618
commit
605b2bbc41
3 changed files with 18 additions and 4 deletions
|
|
@ -346,14 +346,19 @@ static void dbus_entry_free(struct dbus_entry *de) {
|
||||||
static int get_volume_arg(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, pa_channel_map *map, pa_cvolume *vol) {
|
static int get_volume_arg(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, pa_channel_map *map, pa_cvolume *vol) {
|
||||||
DBusMessageIter array_iter;
|
DBusMessageIter array_iter;
|
||||||
DBusMessageIter struct_iter;
|
DBusMessageIter struct_iter;
|
||||||
|
char *signature;
|
||||||
|
|
||||||
pa_assert(conn);
|
pa_assert(conn);
|
||||||
pa_assert(msg);
|
pa_assert(msg);
|
||||||
pa_assert(iter);
|
pa_assert(iter);
|
||||||
pa_assert(pa_streq(dbus_message_iter_get_signature(iter), "a(uu)"));
|
|
||||||
pa_assert(map);
|
pa_assert(map);
|
||||||
pa_assert(vol);
|
pa_assert(vol);
|
||||||
|
|
||||||
|
pa_assert_se(signature = dbus_message_iter_get_signature(iter));
|
||||||
|
pa_assert(pa_streq(signature, "a(uu)"));
|
||||||
|
|
||||||
|
dbus_free(signature);
|
||||||
|
|
||||||
pa_channel_map_init(map);
|
pa_channel_map_init(map);
|
||||||
pa_cvolume_init(vol);
|
pa_cvolume_init(vol);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -735,6 +735,7 @@ void pa_dbus_append_proplist_variant_dict_entry(DBusMessageIter *dict_iter, cons
|
||||||
pa_proplist *pa_dbus_get_proplist_arg(DBusConnection *c, DBusMessage *msg, DBusMessageIter *iter) {
|
pa_proplist *pa_dbus_get_proplist_arg(DBusConnection *c, DBusMessage *msg, DBusMessageIter *iter) {
|
||||||
DBusMessageIter dict_iter;
|
DBusMessageIter dict_iter;
|
||||||
DBusMessageIter dict_entry_iter;
|
DBusMessageIter dict_entry_iter;
|
||||||
|
char *signature;
|
||||||
pa_proplist *proplist = NULL;
|
pa_proplist *proplist = NULL;
|
||||||
const char *key = NULL;
|
const char *key = NULL;
|
||||||
const uint8_t *value = NULL;
|
const uint8_t *value = NULL;
|
||||||
|
|
@ -743,7 +744,11 @@ pa_proplist *pa_dbus_get_proplist_arg(DBusConnection *c, DBusMessage *msg, DBusM
|
||||||
pa_assert(c);
|
pa_assert(c);
|
||||||
pa_assert(msg);
|
pa_assert(msg);
|
||||||
pa_assert(iter);
|
pa_assert(iter);
|
||||||
pa_assert(pa_streq(dbus_message_iter_get_signature(iter), "a{say}"));
|
|
||||||
|
pa_assert(signature = dbus_message_iter_get_signature(iter));
|
||||||
|
pa_assert_se(pa_streq(signature, "a{say}"));
|
||||||
|
|
||||||
|
dbus_free(signature);
|
||||||
|
|
||||||
proplist = pa_proplist_new();
|
proplist = pa_proplist_new();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ struct call_info {
|
||||||
const char *property_interface; /* The interface argument of a property call is stored here. */
|
const char *property_interface; /* The interface argument of a property call is stored here. */
|
||||||
pa_dbus_property_handler *property_handler;
|
pa_dbus_property_handler *property_handler;
|
||||||
const char *expected_property_sig; /* Property signature from the introspection data. */
|
const char *expected_property_sig; /* Property signature from the introspection data. */
|
||||||
const char *property_sig; /* The signature of the new value in the received .Set message. */
|
char *property_sig; /* The signature of the new value in the received .Set message. */
|
||||||
DBusMessageIter variant_iter; /* Iterator pointing to the beginning of the new value variant of a .Set call. */
|
DBusMessageIter variant_iter; /* Iterator pointing to the beginning of the new value variant of a .Set call. */
|
||||||
|
|
||||||
const char *method; /* Method name (extracted from the message). */
|
const char *method; /* Method name (extracted from the message). */
|
||||||
|
|
@ -431,7 +431,7 @@ static enum find_result_t find_handler_from_properties_call(struct call_info *ca
|
||||||
|
|
||||||
dbus_message_iter_recurse(&msg_iter, &call_info->variant_iter);
|
dbus_message_iter_recurse(&msg_iter, &call_info->variant_iter);
|
||||||
|
|
||||||
call_info->property_sig = dbus_message_iter_get_signature(&call_info->variant_iter);
|
pa_assert_se(call_info->property_sig = dbus_message_iter_get_signature(&call_info->variant_iter));
|
||||||
|
|
||||||
if (*call_info->property_interface) {
|
if (*call_info->property_interface) {
|
||||||
if (!(call_info->iface_entry = pa_hashmap_get(call_info->obj_entry->interfaces, call_info->property_interface)))
|
if (!(call_info->iface_entry = pa_hashmap_get(call_info->obj_entry->interfaces, call_info->property_interface)))
|
||||||
|
|
@ -494,6 +494,7 @@ static enum find_result_t find_handler(struct call_info *call_info) {
|
||||||
static DBusHandlerResult handle_message_cb(DBusConnection *connection, DBusMessage *message, void *user_data) {
|
static DBusHandlerResult handle_message_cb(DBusConnection *connection, DBusMessage *message, void *user_data) {
|
||||||
pa_dbus_protocol *p = user_data;
|
pa_dbus_protocol *p = user_data;
|
||||||
struct call_info call_info;
|
struct call_info call_info;
|
||||||
|
call_info.property_sig = NULL;
|
||||||
|
|
||||||
pa_assert(connection);
|
pa_assert(connection);
|
||||||
pa_assert(message);
|
pa_assert(message);
|
||||||
|
|
@ -588,6 +589,9 @@ static DBusHandlerResult handle_message_cb(DBusConnection *connection, DBusMessa
|
||||||
}
|
}
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
|
if (call_info.property_sig)
|
||||||
|
dbus_free(call_info.property_sig);
|
||||||
|
|
||||||
return DBUS_HANDLER_RESULT_HANDLED;
|
return DBUS_HANDLER_RESULT_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue