Explorar el Código

libobs: Fix dstr leak

jpark37 hace 5 años
padre
commit
ccf16ddb65
Se han modificado 1 ficheros con 5 adiciones y 3 borrados
  1. 5 3
      libobs/util/platform-windows.c

+ 5 - 3
libobs/util/platform-windows.c

@@ -73,9 +73,10 @@ void *os_dlopen(const char *path)
 	dstr_replace(&dll_name, "\\", "/");
 	if (!dstr_find(&dll_name, ".dll"))
 		dstr_cat(&dll_name, ".dll");
-
 	os_utf8_to_wcs_ptr(dll_name.array, 0, &wpath);
 
+	dstr_free(&dll_name);
+
 	/* to make module dependency issues easier to deal with, allow
 	 * dynamically loaded libraries on windows to search for dependent
 	 * libraries that are within the library's own directory */
@@ -87,8 +88,8 @@ void *os_dlopen(const char *path)
 	}
 
 	h_library = LoadLibraryW(wpath);
+
 	bfree(wpath);
-	dstr_free(&dll_name);
 
 	if (wpath_slash)
 		SetDllDirectoryW(NULL);
@@ -156,9 +157,10 @@ bool os_is_obs_plugin(const char *path)
 	dstr_replace(&dll_name, "\\", "/");
 	if (!dstr_find(&dll_name, ".dll"))
 		dstr_cat(&dll_name, ".dll");
-
 	os_utf8_to_wcs_ptr(dll_name.array, 0, &wpath);
 
+	dstr_free(&dll_name);
+
 	hFile = CreateFileW(wpath, GENERIC_READ, FILE_SHARE_READ, NULL,
 			    OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);