]> git.sesse.net Git - vlc/blobdiff - src/misc/win32_specific.c
remove memory leak
[vlc] / src / misc / win32_specific.c
index 621a47b30b80cac5ad47332bf0ac7bd2e48782d3..41e10b7f8e71197b10454060dcabee70db4beb44 100644 (file)
@@ -218,7 +218,7 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
                 COPYDATASTRUCT wm_data;
                 int i_opt;
                 vlc_ipc_data_t *p_data;
-                size_t i_data = sizeof (p_data);
+                size_t i_data = sizeof (*p_data);
 
                 for( i_opt = optind; i_opt < *pi_argc; i_opt++ )
                 {
@@ -237,9 +237,10 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
                      * with stronger alignment requirements, right. */
                     *((size_t *)(p_data->data + i_data)) = i_len;
                     i_data += sizeof (size_t);
-                    memcpy( &p_data[i_data], ppsz_argv[ i_opt ], i_len );
+                    memcpy( &p_data->data[i_data], ppsz_argv[ i_opt ], i_len );
                     i_data += i_len;
                 }
+                i_data += sizeof (*p_data);
 
                 /* Send our playlist items to the 1st instance */
                 wm_data.dwData = 0;
@@ -321,9 +322,8 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
             ppsz_argv = (char **)malloc( i_argc * sizeof(char *) );
             for( i_opt = 0; i_opt < i_argc; i_opt++ )
             {
-                ppsz_argv[i_opt] = &p_data[i_data + sizeof(int)];
-                i_data += *((int *)&p_data[i_data]);
-                i_data += sizeof(int);
+                ppsz_argv[i_opt] = p_data->data + i_data + sizeof(int);
+                i_data += sizeof(int) + *((int *)(p_data->data + i_data));
             }
 
             for( i_opt = 0; i_opt < i_argc; i_opt++ )
@@ -368,3 +368,12 @@ void system_End( libvlc_int_t *p_this )
 
     WSACleanup();
 }
+
+/*****************************************************************************
+ *  system_VLCPath
+ *  **************************************************************************/
+const char* system_VLCPath( void )
+{
+    libvlc_global_data_t* libvlc_global = vlc_global();
+    return libvlc_global->psz_vlcpath;
+}