mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Added patches for memory allocation cleanup in gdiplus functions.
This commit is contained in:
parent
4c11394828
commit
22c57980db
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -7,6 +7,7 @@ wine-staging (1.7.54) UNRELEASED; urgency=low
|
||||
* Added patch to implement FileNamesInformation class support for
|
||||
NtQueryDirectoryFile.
|
||||
* Added patch for implementation of additional HSTRING functions.
|
||||
* Added patches for memory allocation cleanup in gdiplus functions.
|
||||
* Removed patch to implement kernel32.GetPhysicallyInstalledSystemMemory
|
||||
(accepted upstream).
|
||||
* Partially removed patches for ws2_32 TransmitFile (accepted upstream).
|
||||
|
@ -0,0 +1,36 @@
|
||||
From 2a6a4f79c1d443bd7e26cd98f5be47cbde54c1a8 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Wed, 21 Oct 2015 00:52:51 +0200
|
||||
Subject: gdiplus: Use the correct memory allocation function for PropVariants.
|
||||
|
||||
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
---
|
||||
dlls/gdiplus/image.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
|
||||
index 0a8027a..06cf633 100644
|
||||
--- a/dlls/gdiplus/image.c
|
||||
+++ b/dlls/gdiplus/image.c
|
||||
@@ -3065,7 +3065,7 @@ static BOOL get_bool_property(IWICMetadataReader *reader, const GUID *guid, cons
|
||||
PropVariantInit(&value);
|
||||
|
||||
id.vt = VT_LPWSTR;
|
||||
- id.u.pwszVal = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(prop_name) + 1) * sizeof(WCHAR));
|
||||
+ id.u.pwszVal = CoTaskMemAlloc((lstrlenW(prop_name) + 1) * sizeof(WCHAR));
|
||||
if (!id.u.pwszVal) return FALSE;
|
||||
lstrcpyW(id.u.pwszVal, prop_name);
|
||||
hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value);
|
||||
@@ -3092,7 +3092,7 @@ static PropertyItem *get_property(IWICMetadataReader *reader, const GUID *guid,
|
||||
PropVariantInit(&value);
|
||||
|
||||
id.vt = VT_LPWSTR;
|
||||
- id.u.pwszVal = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(prop_name) + 1) * sizeof(WCHAR));
|
||||
+ id.u.pwszVal = CoTaskMemAlloc((lstrlenW(prop_name) + 1) * sizeof(WCHAR));
|
||||
if (!id.u.pwszVal) return NULL;
|
||||
lstrcpyW(id.u.pwszVal, prop_name);
|
||||
hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value);
|
||||
--
|
||||
2.6.1
|
||||
|
@ -0,0 +1,77 @@
|
||||
From a6febdb275f477877e886c8a99a0426061a22ff0 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Wed, 21 Oct 2015 00:53:12 +0200
|
||||
Subject: gdiplus: Use helper function for HeapAlloc calls.
|
||||
|
||||
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
---
|
||||
dlls/gdiplus/font.c | 2 +-
|
||||
dlls/gdiplus/gdiplus_private.h | 6 ++++++
|
||||
dlls/gdiplus/image.c | 6 +++---
|
||||
3 files changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
|
||||
index cd9041e..dffba1e 100644
|
||||
--- a/dlls/gdiplus/font.c
|
||||
+++ b/dlls/gdiplus/font.c
|
||||
@@ -1612,7 +1612,7 @@ static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
|
||||
if (fonts->allocated == fonts->count)
|
||||
{
|
||||
INT new_alloc_count = fonts->allocated+50;
|
||||
- GpFontFamily** new_family_list = HeapAlloc(GetProcessHeap(), 0, new_alloc_count*sizeof(void*));
|
||||
+ GpFontFamily** new_family_list = heap_alloc(new_alloc_count*sizeof(void*));
|
||||
|
||||
if (!new_family_list)
|
||||
return 0;
|
||||
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
|
||||
index 4b7e4c8..d0faac2 100644
|
||||
--- a/dlls/gdiplus/gdiplus_private.h
|
||||
+++ b/dlls/gdiplus/gdiplus_private.h
|
||||
@@ -48,6 +48,12 @@
|
||||
#define GIF_DISPOSE_RESTORE_TO_BKGND 2
|
||||
#define GIF_DISPOSE_RESTORE_TO_PREV 3
|
||||
|
||||
+static void *heap_alloc(size_t len) __WINE_ALLOC_SIZE(1);
|
||||
+static inline void *heap_alloc(size_t len)
|
||||
+{
|
||||
+ return HeapAlloc(GetProcessHeap(), 0, len);
|
||||
+}
|
||||
+
|
||||
static void *heap_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1);
|
||||
static inline void *heap_alloc_zero(size_t len)
|
||||
{
|
||||
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
|
||||
index 06cf633..5777cf7 100644
|
||||
--- a/dlls/gdiplus/image.c
|
||||
+++ b/dlls/gdiplus/image.c
|
||||
@@ -92,7 +92,7 @@ static ColorPalette *get_palette(IWICBitmapFrameDecode *frame, WICBitmapPaletteT
|
||||
UINT count;
|
||||
|
||||
IWICPalette_GetColorCount(wic_palette, &count);
|
||||
- palette = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(UINT) + count * sizeof(ARGB));
|
||||
+ palette = heap_alloc(2 * sizeof(UINT) + count * sizeof(ARGB));
|
||||
IWICPalette_GetColors(wic_palette, count, palette->Entries, &palette->Count);
|
||||
|
||||
IWICPalette_GetType(wic_palette, &type);
|
||||
@@ -1692,7 +1692,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
|
||||
{
|
||||
if (iinfo.hbmMask)
|
||||
{
|
||||
- BYTE *bits = HeapAlloc(GetProcessHeap(), 0, height * stride);
|
||||
+ BYTE *bits = heap_alloc(height * stride);
|
||||
|
||||
/* read alpha data from the mask */
|
||||
if (iinfo.hbmColor)
|
||||
@@ -2874,7 +2874,7 @@ GpStatus WINGDIPAPI GdipGetAllPropertyItems(GpImage *image, UINT size,
|
||||
item_size = propvariant_size(&value);
|
||||
if (item_size)
|
||||
{
|
||||
- item = HeapAlloc(GetProcessHeap(), 0, item_size + sizeof(*item));
|
||||
+ item = heap_alloc(item_size + sizeof(*item));
|
||||
|
||||
propvariant_to_item(&value, item, item_size + sizeof(*item), id.u.uiVal);
|
||||
buf[i].id = item->id;
|
||||
--
|
||||
2.6.1
|
||||
|
@ -0,0 +1,65 @@
|
||||
From 94bb0566b681365ee04cf6ac08d97ef05003f0ed Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Wed, 21 Oct 2015 00:53:31 +0200
|
||||
Subject: gdiplus: Use helper function for HeapReAlloc calls.
|
||||
|
||||
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
---
|
||||
dlls/gdiplus/gdiplus.c | 6 ++----
|
||||
dlls/gdiplus/gdiplus_private.h | 6 ++++++
|
||||
dlls/gdiplus/stringformat.c | 2 +-
|
||||
3 files changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c
|
||||
index 32f20d8..1281455 100644
|
||||
--- a/dlls/gdiplus/gdiplus.c
|
||||
+++ b/dlls/gdiplus/gdiplus.c
|
||||
@@ -420,12 +420,10 @@ BOOL lengthen_path(GpPath *path, INT len)
|
||||
while(path->datalen - path->pathdata.Count < len)
|
||||
path->datalen *= 2;
|
||||
|
||||
- path->pathdata.Points = HeapReAlloc(GetProcessHeap(), 0,
|
||||
- path->pathdata.Points, path->datalen * sizeof(PointF));
|
||||
+ path->pathdata.Points = heap_realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
|
||||
if(!path->pathdata.Points) return FALSE;
|
||||
|
||||
- path->pathdata.Types = HeapReAlloc(GetProcessHeap(), 0,
|
||||
- path->pathdata.Types, path->datalen);
|
||||
+ path->pathdata.Types = heap_realloc(path->pathdata.Types, path->datalen);
|
||||
if(!path->pathdata.Types) return FALSE;
|
||||
}
|
||||
|
||||
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
|
||||
index d0faac2..1af0bd0 100644
|
||||
--- a/dlls/gdiplus/gdiplus_private.h
|
||||
+++ b/dlls/gdiplus/gdiplus_private.h
|
||||
@@ -60,6 +60,12 @@ static inline void *heap_alloc_zero(size_t len)
|
||||
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
||||
}
|
||||
|
||||
+static void *heap_realloc(void *mem, size_t len) __WINE_ALLOC_SIZE(2);
|
||||
+static inline void *heap_realloc(void *mem, size_t len)
|
||||
+{
|
||||
+ return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
||||
+}
|
||||
+
|
||||
static inline BOOL heap_free(void *mem)
|
||||
{
|
||||
return HeapFree(GetProcessHeap(), 0, mem);
|
||||
diff --git a/dlls/gdiplus/stringformat.c b/dlls/gdiplus/stringformat.c
|
||||
index 8791ceb..b89458b 100644
|
||||
--- a/dlls/gdiplus/stringformat.c
|
||||
+++ b/dlls/gdiplus/stringformat.c
|
||||
@@ -291,7 +291,7 @@ GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL fir
|
||||
/* reallocation */
|
||||
if((format->tabcount < count) && (format->tabcount > 0)){
|
||||
REAL *ptr;
|
||||
- ptr = HeapReAlloc(GetProcessHeap(), 0, format->tabs, sizeof(REAL)*count);
|
||||
+ ptr = heap_realloc(format->tabs, sizeof(REAL)*count);
|
||||
if(!ptr)
|
||||
return OutOfMemory;
|
||||
format->tabs = ptr;
|
||||
--
|
||||
2.6.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 74a41170aaf163ed000ca63a606dfd55e56af87f Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Wed, 21 Oct 2015 00:53:48 +0200
|
||||
Subject: gdiplus: Use helper function for remaining HeapFree calls.
|
||||
|
||||
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
---
|
||||
dlls/gdiplus/font.c | 4 ++--
|
||||
dlls/gdiplus/image.c | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
|
||||
index dffba1e..63eaed2 100644
|
||||
--- a/dlls/gdiplus/font.c
|
||||
+++ b/dlls/gdiplus/font.c
|
||||
@@ -1590,7 +1590,7 @@ void free_installed_fonts(void)
|
||||
{
|
||||
while (installedFontCollection.count)
|
||||
GdipDeleteFontFamily(installedFontCollection.FontFamilies[--installedFontCollection.count]);
|
||||
- HeapFree(GetProcessHeap(), 0, installedFontCollection.FontFamilies);
|
||||
+ heap_free(installedFontCollection.FontFamilies);
|
||||
installedFontCollection.FontFamilies = NULL;
|
||||
installedFontCollection.allocated = 0;
|
||||
}
|
||||
@@ -1618,7 +1618,7 @@ static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
|
||||
return 0;
|
||||
|
||||
memcpy(new_family_list, fonts->FontFamilies, fonts->count*sizeof(void*));
|
||||
- HeapFree(GetProcessHeap(), 0, fonts->FontFamilies);
|
||||
+ heap_free(fonts->FontFamilies);
|
||||
fonts->FontFamilies = new_family_list;
|
||||
fonts->allocated = new_alloc_count;
|
||||
}
|
||||
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
|
||||
index 5777cf7..19c7468 100644
|
||||
--- a/dlls/gdiplus/image.c
|
||||
+++ b/dlls/gdiplus/image.c
|
||||
@@ -1716,7 +1716,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
|
||||
dst_row += lockeddata.Stride;
|
||||
}
|
||||
|
||||
- HeapFree(GetProcessHeap(), 0, bits);
|
||||
+ heap_free(bits);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2884,7 +2884,7 @@ GpStatus WINGDIPAPI GdipGetAllPropertyItems(GpImage *image, UINT size,
|
||||
memcpy(item_value, item->value, item_size);
|
||||
item_value += item_size;
|
||||
|
||||
- HeapFree(GetProcessHeap(), 0, item);
|
||||
+ heap_free(item);
|
||||
}
|
||||
|
||||
PropVariantClear(&id);
|
||||
--
|
||||
2.6.1
|
||||
|
@ -140,6 +140,7 @@ patch_enable_all ()
|
||||
enable_gdi32_Lazy_Font_Initialization="$1"
|
||||
enable_gdi32_MaxPixelFormats="$1"
|
||||
enable_gdi32_MultiMonitor="$1"
|
||||
enable_gdiplus_Memory_Allocation="$1"
|
||||
enable_ieframe_IViewObject_Draw="$1"
|
||||
enable_imagehlp_BindImageEx="$1"
|
||||
enable_imagehlp_Cleanup="$1"
|
||||
@ -516,6 +517,9 @@ patch_enable ()
|
||||
gdi32-MultiMonitor)
|
||||
enable_gdi32_MultiMonitor="$2"
|
||||
;;
|
||||
gdiplus-Memory_Allocation)
|
||||
enable_gdiplus_Memory_Allocation="$2"
|
||||
;;
|
||||
ieframe-IViewObject-Draw)
|
||||
enable_ieframe_IViewObject_Draw="$2"
|
||||
;;
|
||||
@ -3181,6 +3185,25 @@ if test "$enable_gdi32_MultiMonitor" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset gdiplus-Memory_Allocation
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/gdiplus/font.c, dlls/gdiplus/gdiplus.c, dlls/gdiplus/gdiplus_private.h, dlls/gdiplus/image.c,
|
||||
# | dlls/gdiplus/stringformat.c
|
||||
# |
|
||||
if test "$enable_gdiplus_Memory_Allocation" -eq 1; then
|
||||
patch_apply gdiplus-Memory_Allocation/0001-gdiplus-Use-the-correct-memory-allocation-function-f.patch
|
||||
patch_apply gdiplus-Memory_Allocation/0002-gdiplus-Use-helper-function-for-HeapAlloc-calls.patch
|
||||
patch_apply gdiplus-Memory_Allocation/0003-gdiplus-Use-helper-function-for-HeapReAlloc-calls.patch
|
||||
patch_apply gdiplus-Memory_Allocation/0004-gdiplus-Use-helper-function-for-remaining-HeapFree-c.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "gdiplus: Use the correct memory allocation function for PropVariants.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "gdiplus: Use helper function for HeapAlloc calls.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "gdiplus: Use helper function for HeapReAlloc calls.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "gdiplus: Use helper function for remaining HeapFree calls.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ieframe-IViewObject-Draw
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
Loading…
Reference in New Issue
Block a user