Discussion:
[PATCH] gsupplicant:Fix possible memory leak in signal_peer_found function
(too old to reply)
Maneesh Jain
2015-10-05 10:05:18 UTC
Permalink
Signed-off-by: Maneesh Jain <***@samsung.com>
---
gsupplicant/supplicant.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 6a62026..ad53a56 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2779,7 +2779,8 @@ static void signal_peer_found(const char *path, DBusMessageIter *iter)
GSupplicantInterface *interface;
const char *obj_path = NULL;
GSupplicantPeer *peer;
-
+ int ret;
+
SUPPLICANT_DBG("");

interface = g_hash_table_lookup(interface_table, path);
@@ -2816,10 +2817,15 @@ static void signal_peer_found(const char *path, DBusMessageIter *iter)
peer_property(NULL, NULL, property_data);
return;
}
+
+ ret = supplicant_dbus_property_get_all(obj_path,
+ SUPPLICANT_INTERFACE ".Peer",
+ peer_property, property_data, NULL);
+ if (ret < 0) {
+ dbus_free(property_data);
+ return;
+ }

- supplicant_dbus_property_get_all(obj_path,
- SUPPLICANT_INTERFACE ".Peer",
- peer_property, property_data, NULL);
}

static void signal_peer_lost(const char *path, DBusMessageIter *iter)
--
1.9.1
Patrik Flykt
2015-10-08 07:09:41 UTC
Permalink
We don't do/need signed-off-bys in this project. Short description here
of the cause of the fix like "If supplicant_dbus_property_get_all()
returns and error, the callback function will not be called and
property_data will not be freed" or such, so that the next person's
attention is focused on the fix and need not necessarily look up the
function to understand if this really was necessary.
Post by Maneesh Jain
---
gsupplicant/supplicant.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 6a62026..ad53a56 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2779,7 +2779,8 @@ static void signal_peer_found(const char *path, DBusMessageIter *iter)
GSupplicantInterface *interface;
const char *obj_path = NULL;
GSupplicantPeer *peer;
-
+ int ret;
+
NACK. Trailing whitespace. Please don't send MSDOS formatted patches,
all lines in the patch end with ^M.
Post by Maneesh Jain
SUPPLICANT_DBG("");
interface = g_hash_table_lookup(interface_table, path);
@@ -2816,10 +2817,15 @@ static void signal_peer_found(const char *path, DBusMessageIter *iter)
peer_property(NULL, NULL, property_data);
return;
}
+
+ ret = supplicant_dbus_property_get_all(obj_path,
+ SUPPLICANT_INTERFACE ".Peer",
+ peer_property, property_data, NULL);
+ if (ret < 0) {
+ dbus_free(property_data);
+ return;
+ }
- supplicant_dbus_property_get_all(obj_path,
- SUPPLICANT_INTERFACE ".Peer",
- peer_property, property_data, NULL);
}
static void signal_peer_lost(const char *path, DBusMessageIter *iter)
Patrik

Loading...