mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-15 08:14:28 +08:00
client: Fix core dump when using set-advertise-name
If repeating to set on/off with set-advertise-name after setting local name, and then may dump core by double free. This patch uses g_free() instead of free().
This commit is contained in:
parent
115fd96871
commit
15225b1e0b
@ -547,8 +547,10 @@ void ad_advertise_name(DBusConnection *conn, bool value)
|
||||
|
||||
ad.name = value;
|
||||
|
||||
if (!value)
|
||||
free(ad.local_name);
|
||||
if (!value) {
|
||||
g_free(ad.local_name);
|
||||
ad.local_name = NULL;
|
||||
}
|
||||
|
||||
g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "Includes");
|
||||
}
|
||||
@ -558,7 +560,7 @@ void ad_advertise_local_name(DBusConnection *conn, const char *name)
|
||||
if (ad.local_name && !strcmp(name, ad.local_name))
|
||||
return;
|
||||
|
||||
free(ad.local_name);
|
||||
g_free(ad.local_name);
|
||||
ad.local_name = strdup(name);
|
||||
|
||||
g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "LocalName");
|
||||
|
Loading…
Reference in New Issue
Block a user