Fix memory leak in loading function
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 5 Jan 2009 01:45:04 +0000 (02:45 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 5 Jan 2009 01:45:04 +0000 (02:45 +0100)
src/device.c

index 98669185f5656240ab0c98e3df727d1323c9a47b..1bc0d837573cca3154843aa31f2904de1c215777 100644 (file)
@@ -1209,7 +1209,7 @@ static int device_load(struct connman_device *device)
        GKeyFile *keyfile;
        gchar *pathname, *data = NULL;
        gsize length;
-       const char *str;
+       char *str;
 
        DBG("device %p", device);
 
@@ -1236,8 +1236,10 @@ static int device_load(struct connman_device *device)
        g_free(data);
 
        str = g_key_file_get_string(keyfile, "Configuration", "Policy", NULL);
-       if (str != NULL)
+       if (str != NULL) {
                device->policy = string2policy(str);
+               g_free(str);
+       }
 
        g_key_file_free(keyfile);