blob: a82dec1ad0fc4f11d591fd28354f4e2f749a5589 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
From 9460f4292b130fcca58519a1c52b9aaef3265042 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Wed, 16 May 2018 16:15:50 -0400
Subject: [PATCH] primitives: ensure primitives_get() returns a populated
struct
Fixes: https://github.com/FreeRDP/FreeRDP/issues/4658
---
libfreerdp/primitives/primitives.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libfreerdp/primitives/primitives.c b/libfreerdp/primitives/primitives.c
index fd236df6e7..d25c5b41dc 100644
--- a/libfreerdp/primitives/primitives.c
+++ b/libfreerdp/primitives/primitives.c
@@ -28,10 +28,12 @@
#include "prim_internal.h"
/* Singleton pointer used throughout the program when requested. */
-static primitives_t pPrimitives = { 0 };
static primitives_t pPrimitivesGeneric = { 0 };
static INIT_ONCE generic_primitives_InitOnce = INIT_ONCE_STATIC_INIT;
+#if defined(HAVE_OPTIMIZED_PRIMITIVES)
+static primitives_t pPrimitives = { 0 };
static INIT_ONCE primitives_InitOnce = INIT_ONCE_STATIC_INIT;
+#endif
/* ------------------------------------------------------------------------- */
@@ -74,8 +76,10 @@ primitives_t* primitives_get(void)
InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic, NULL, NULL);
#if defined(HAVE_OPTIMIZED_PRIMITIVES)
InitOnceExecuteOnce(&primitives_InitOnce, primitives_init, NULL, NULL);
-#endif
return &pPrimitives;
+#else
+ return &pPrimitivesGeneric;
+#endif
}
primitives_t* primitives_get_generic(void)
|