freerdp/cache-persist-use-winpr_aligned_calloc.patch
2026-05-11 17:35:23 -04:00

48 lines
1.5 KiB
Diff

From 4d45e4715adfa57dfc0a829ec351dbe2680e756b Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Tue, 28 Apr 2026 05:15:25 +0000
Subject: [PATCH] [cache,persist] use winpr_aligned_calloc
Backport of commit a48dbde2c8a5b8b70a9d1c045d969a71afd6284c.
`nullptr` replaced with `NULL` (not available in 3.10.3).
Made-with: Cursor
---
libfreerdp/cache/persistent.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libfreerdp/cache/persistent.c b/libfreerdp/cache/persistent.c
index 39be803..e963c5e 100644
--- a/libfreerdp/cache/persistent.c
+++ b/libfreerdp/cache/persistent.c
@@ -39,6 +39,7 @@ struct rdp_persistent_cache
size_t bmpSize;
};
+static const size_t PERSIST_ALIGN = 32;
static const char sig_str[] = "RDP8bmp";
int persistent_cache_get_version(rdpPersistentCache* persistent)
@@ -155,7 +156,7 @@ static int persistent_cache_read_entry_v3(rdpPersistentCache* persistent,
{
persistent->bmpSize = size;
BYTE* bmpData = (BYTE*)winpr_aligned_recalloc(persistent->bmpData, persistent->bmpSize,
- sizeof(BYTE), 32);
+ sizeof(BYTE), PERSIST_ALIGN);
if (!bmpData)
return -1;
@@ -350,7 +351,7 @@ rdpPersistentCache* persistent_cache_new(void)
return NULL;
persistent->bmpSize = 0x4000;
- persistent->bmpData = calloc(1, persistent->bmpSize);
+ persistent->bmpData = winpr_aligned_calloc(1, persistent->bmpSize, PERSIST_ALIGN);
if (!persistent->bmpData)
{
--
2.53.0