[MPlayer-cvslog] r31184 - trunk/libvo/w32_common.c

reimar subversion at mplayerhq.hu
Wed May 19 19:58:18 CEST 2010


Author: reimar
Date: Wed May 19 19:58:17 2010
New Revision: 31184

Log:
Do not return pointer to on-stack memory.

Modified:
   trunk/libvo/w32_common.c

Modified: trunk/libvo/w32_common.c
==============================================================================
--- trunk/libvo/w32_common.c	Wed May 19 19:55:39 2010	(r31183)
+++ trunk/libvo/w32_common.c	Wed May 19 19:58:17 2010	(r31184)
@@ -410,6 +410,7 @@ int vo_w32_config(uint32_t width, uint32
 
 /**
  * \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 @@ static char *get_display_name(void) {
     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 @@ int vo_w32_init(void) {
     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);


More information about the MPlayer-cvslog mailing list