فهرست منبع

libobs: Fix leak with empty path in stats

If the recording path is left empty in Settings, a leak can occur in
window-basic-stats.cpp because a bmalloc is called for a size 1.
This fixes the leak by checking against the path in the
os_get_free_disk_space function.

Signed-off-by: pkv <[email protected]>
pkv 2 سال پیش
والد
کامیت
a0a23e8a18
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      libobs/util/platform-windows.c

+ 2 - 1
libobs/util/platform-windows.c

@@ -1469,7 +1469,8 @@ uint64_t os_get_proc_virtual_size(void)
 uint64_t os_get_free_disk_space(const char *dir)
 {
 	wchar_t *wdir = NULL;
-	if (!os_utf8_to_wcs_ptr(dir, 0, &wdir))
+	os_utf8_to_wcs_ptr(dir, 0, &wdir);
+	if (!wdir)
 		return 0;
 
 	ULARGE_INTEGER free;