From 40b1ca25fe1b3ff354ddee314ad3f4c1e1728019 Mon Sep 17 00:00:00 2001 From: Chupligin Sergey Date: Tue, 11 Jan 2022 15:21:43 +0000 Subject: [PATCH] Fix memory leak --- src/usb_moded-config.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/usb_moded-config.c b/src/usb_moded-config.c index 5ba14e0..d08b3c7 100644 --- a/src/usb_moded-config.c +++ b/src/usb_moded-config.c @@ -1068,9 +1068,15 @@ char * config_get_android_manufacturer(void) // Create a new GKeyFile object and a bitwise list of flags. hwReleaseFile = g_key_file_new(); - if (g_key_file_load_from_file(hwReleaseFile, "/etc/hw-release", G_KEY_FILE_NONE, &error)) { + if (g_key_file_load_from_file(hwReleaseFile, "/etc/hw-release", G_KEY_FILE_NONE, &error)) + { return g_key_file_get_string(hwReleaseFile, NULL, "MANUFACTURER", NULL); } + else + { + g_free(hwReleaseFile); + return "n/a"; + } #endif return config_get_conf_string(ANDROID_ENTRY, ANDROID_MANUFACTURER_KEY);