From: Nagaraj D R <nagaraj.dr@samsung.com>
To: linux-bluetooth@vger.kernel.org
Cc: Syam Sidhardhan <s.syam@samsung.com>,
Nagaraj D R <nagaraj.dr@samsung.com>
Subject: [PATCH] Fix improper usage of g_free
Date: Fri, 18 May 2018 09:14:08 +0530 [thread overview]
Message-ID: <1526615048-23393-1-git-send-email-nagaraj.dr@samsung.com> (raw)
In-Reply-To: CGME20180518034418epcas2p3b31813a79452e5934a438347b8edc82a@epcas2p3.samsung.com
g_free should be used for only those memory allocations
done through glib APIs
---
client/advertising.c | 2 +-
src/adapter.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/advertising.c b/client/advertising.c
index 045133a..5592be6 100644
--- a/client/advertising.c
+++ b/client/advertising.c
@@ -757,7 +757,7 @@ void ad_advertise_local_name(DBusConnection *conn, const char *name)
return;
g_free(ad.local_name);
- ad.local_name = strdup(name);
+ ad.local_name = g_strdup(name);
g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "LocalName");
diff --git a/src/adapter.c b/src/adapter.c
index c1c792a..07a4e42 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2258,7 +2258,7 @@ static bool parse_uuids(DBusMessageIter *value, struct discovery_filter *filter)
bt_uuid_to_uuid128(&uuid, &u128);
bt_uuid_to_string(&u128, uuidstr, sizeof(uuidstr));
- filter->uuids = g_slist_prepend(filter->uuids, strdup(uuidstr));
+ filter->uuids = g_slist_prepend(filter->uuids, g_strdup(uuidstr));
dbus_message_iter_next(&arriter);
}
--
1.9.1
next parent reply other threads:[~2018-05-18 3:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20180518034418epcas2p3b31813a79452e5934a438347b8edc82a@epcas2p3.samsung.com>
2018-05-18 3:44 ` Nagaraj D R [this message]
2018-05-21 8:37 ` [PATCH] Fix improper usage of g_free Luiz Augusto von Dentz
[not found] ` <CGME20180518034418epcas2p3b31813a79452e5934a438347b8edc82a@epcms5p2>
2018-05-21 11:39 ` Nagaraj D R
2018-05-21 13:03 ` Luiz Augusto von Dentz
[not found] <CGME20180522032519epcas2p3cf940be103b17857bcb293a8bc37e5f8@epcas2p3.samsung.com>
2018-05-22 3:25 ` Nagaraj D R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1526615048-23393-1-git-send-email-nagaraj.dr@samsung.com \
--to=nagaraj.dr@samsung.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=s.syam@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).