From e0eeef1030e0fd869a93d97a7354a8c8b363a07f Mon Sep 17 00:00:00 2001 From: ERAMOTO Masaya Date: Wed, 21 Jun 2017 19:07:19 +0900 Subject: [PATCH] client: Fix memory leak due to the option to register an agent When bluetoothctl runs with the command line option "-a ", it does not free the variable auto_register_agent registering the initial agent and allocates new memory for it. This frees the allocated memory before allocating new memory. (The related commit id is 6db3470c2ea161b4b808ad1fc80dfd7e014fd359.) --- client/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client/main.c b/client/main.c index 8f75f0e32..1b9c68343 100644 --- a/client/main.c +++ b/client/main.c @@ -2571,6 +2571,7 @@ static gboolean parse_agent(const char *key, const char *value, if (!value) return FALSE; + g_free(auto_register_agent); auto_register_agent = g_strdup(value); return TRUE; -- 2.47.3