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 9866918..1bc0d83 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);