aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-02-07 15:11:53 +0100
committerAleksander Morgado <aleksander@aleksander.es>2020-02-07 14:42:16 +0000
commita61caff747546441474b1a1fc50c664a13a1378f (patch)
tree81ec3e6aac7262a87a0958e7f3f0834e9f785ad3 /libmm-glib
parenta7a8fc909abeb0abe092feb2603d27216f0e1325 (diff)
iface-modem-location: plug memleaks when updating gps raw variant
The helper method returning a variant from a MMLocationGpsRaw would return already a full variant reference instead of a floating one, so we were really increasing the refcount when doing g_variant_ref_sink() in the location interface. Fix this by consolidating all helper methods in libmm-glib that return variants from the different MMLocationXX objects, so that they all return full variants instead of floating ones.
Diffstat (limited to 'libmm-glib')
-rw-r--r--libmm-glib/mm-location-3gpp.c2
-rw-r--r--libmm-glib/mm-location-gps-nmea.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libmm-glib/mm-location-3gpp.c b/libmm-glib/mm-location-3gpp.c
index bea3913e..c23aeec5 100644
--- a/libmm-glib/mm-location-3gpp.c
+++ b/libmm-glib/mm-location-3gpp.c
@@ -291,7 +291,7 @@ mm_location_3gpp_get_string_variant (MMLocation3gpp *self)
self->priv->cell_id,
self->priv->tracking_area_code);
- variant = g_variant_new_string (str);
+ variant = g_variant_ref_sink (g_variant_new_string (str));
g_free (str);
}
diff --git a/libmm-glib/mm-location-gps-nmea.c b/libmm-glib/mm-location-gps-nmea.c
index ada073f2..fde811fe 100644
--- a/libmm-glib/mm-location-gps-nmea.c
+++ b/libmm-glib/mm-location-gps-nmea.c
@@ -244,7 +244,7 @@ mm_location_gps_nmea_get_string_variant (MMLocationGpsNmea *self)
traces = mm_location_gps_nmea_get_traces (self);
built = g_strjoinv ("\r\n", traces);
- return g_variant_new_string (built);
+ return g_variant_ref_sink (g_variant_new_string (built));
}
/*****************************************************************************/