aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2024-02-26 17:28:11 -0600
committerDenis Kenzior <denkenz@gmail.com>2024-02-26 23:00:19 -0600
commit0695b4df2ca4936b1a7e063f88dedcd05cffaf52 (patch)
treea9097afae163c85052096b5955ca197535986f7b
parentdf0c32bda1865504c22841666e742d399499bf58 (diff)
downloadofono-0695b4df2ca4936b1a7e063f88dedcd05cffaf52.tar.gz
voicecall: Fix memory leak
'number' is obtained using g_key_file_get_string (which returns a newly allocated string), but is never freed.
-rw-r--r--src/voicecall.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/voicecall.c b/src/voicecall.c
index d10fe15a4..f979c46fe 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -3462,7 +3462,7 @@ static void emulator_dial_callback(const struct ofono_error *error, void *data)
struct ofono_voicecall *vc = data;
gboolean need_to_emit;
struct voicecall *v;
- const char *number;
+ char *number;
GError *err = NULL;
number = g_key_file_get_string(vc->settings, SETTINGS_GROUP,
@@ -3484,6 +3484,8 @@ static void emulator_dial_callback(const struct ofono_error *error, void *data)
if (need_to_emit)
voicecalls_emit_call_added(vc, v);
+
+ g_free(number);
}
static void emulator_dial(struct ofono_emulator *em, struct ofono_voicecall *vc,
@@ -3585,7 +3587,7 @@ static void emulator_bldn_cb(struct ofono_emulator *em,
struct ofono_emulator_request *req, void *userdata)
{
struct ofono_voicecall *vc = userdata;
- const char *number;
+ char *number = NULL;
struct ofono_error result;
GError *error = NULL;
@@ -3608,6 +3610,8 @@ fail:
result.type = OFONO_ERROR_TYPE_FAILURE;
ofono_emulator_send_final(em, &result);
};
+
+ g_free(number);
}
static void emulator_hfp_watch(struct ofono_atom *atom,