changeset 31127:aab85e35de52

Do not return pointer to on-stack memory.
author reimar
date Wed, 19 May 2010 17:58:17 +0000
parents 2fef741f9ecc
children 100a50819c58
files libvo/w32_common.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/w32_common.c	Wed May 19 17:55:39 2010 +0000
+++ b/libvo/w32_common.c	Wed May 19 17:58:17 2010 +0000
@@ -410,6 +410,7 @@
 
 /**
  * \brief return the name of the selected device if it is indepedant
+ * \return pointer to string, must be freed.
  */
 static char *get_display_name(void) {
     DISPLAY_DEVICE disp;
@@ -417,7 +418,7 @@
     EnumDisplayDevices(NULL, vo_adapter_num, &disp, 0);
     if (disp.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
         return NULL;
-    return disp.DeviceName;
+    return strdup(disp.DeviceName);
 }
 
 /**
@@ -495,6 +496,7 @@
     dev_hdc = 0;
     dev = get_display_name();
     if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL);
+    free(dev);
     updateScreenProperties();
 
     vo_hdc = vo_w32_get_dc(vo_window);