terminal: free sysview-device names on destruction
authorDavid Herrmann <dh.herrmann@gmail.com>
Thu, 28 Aug 2014 10:25:58 +0000 (12:25 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Thu, 28 Aug 2014 10:45:51 +0000 (12:45 +0200)
Don't leak the device-names during device destruction in sysview. Somehow,
the device-name is "const char*", so make it "char*" first to avoid
warnings when calling free() on it.

src/libsystemd-terminal/sysview-internal.h
src/libsystemd-terminal/sysview.c

index 5aee9f6..9299fab 100644 (file)
@@ -39,7 +39,7 @@
 
 struct sysview_device {
         sysview_seat *seat;
-        const char *name;
+        char *name;
         unsigned int type;
 
         union {
index f5363de..bd345fa 100644 (file)
@@ -98,6 +98,7 @@ sysview_device *sysview_device_free(sysview_device *device) {
                 break;
         }
 
+        free(device->name);
         free(device);
 
         return NULL;