[libgweather] GWeatherLocation: Don't return a copy of the name
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] GWeatherLocation: Don't return a copy of the name
- Date: Tue, 11 Jun 2019 11:16:57 +0000 (UTC)
commit eca3678059f0900191d809d24b4e295c904b79cf
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon Jun 10 13:51:02 2019 +0200
GWeatherLocation: Don't return a copy of the name
The documentation of gweather_location_get_name(), its const return
type, coding conventions and its usage in the library itself all
indicate it shouldn't return a newly allocated string, and is hence
leaking memory.
Fixes https://gitlab.gnome.org/GNOME/libgweather/issues/22
libgweather/gweather-location.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 24a5b60..612a03e 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -578,7 +578,7 @@ gweather_location_get_name (GWeatherLocation *loc)
{
g_return_val_if_fail (loc != NULL, NULL);
- return g_strdup (loc->local_name);
+ return loc->local_name;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]