summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Oliver Stöneberg <oliverst@online.de>2015-01-01 15:02:21 +0100
committer Oliver Stöneberg <oliverst@online.de>2015-01-01 15:02:21 +0100
commit0c0260ec2de1cd9cff7f436d99a598e9a8f99ad8 (patch)
treec55ef98c6d5c3cbb6fe15334d7a6f8090293afa2 /src
parent5d5a89726cc18f7002badecfe20e6dc626a5bbd3 (diff)
"fixed" uninitialized memory usage/data race in osd_work_item_wait (nw)
appears to be a Linux-only issue
Diffstat (limited to 'src')
-rw-r--r--src/osd/sdl/sdlwork.c6
-rw-r--r--src/osd/windows/winwork.c8
2 files changed, 11 insertions, 3 deletions
diff --git a/src/osd/sdl/sdlwork.c b/src/osd/sdl/sdlwork.c
index 58163ea8905..d5f42d91033 100644
--- a/src/osd/sdl/sdlwork.c
+++ b/src/osd/sdl/sdlwork.c
@@ -428,6 +428,11 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
return NULL;
item->event = NULL;
item->queue = queue;
+ item->done = FALSE;
+ }
+ else
+ {
+ atomic_exchange32(&item->done, FALSE); // needs to be set this way to prevent data race/usage of uninitialized memory on Linux
}
// fill in the basics
@@ -436,7 +441,6 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
item->param = parambase;
item->result = NULL;
item->flags = flags;
- atomic_exchange32(&item->done, FALSE);
// advance to the next
lastitem = item;
diff --git a/src/osd/windows/winwork.c b/src/osd/windows/winwork.c
index 6f3927585fd..97162fdaa23 100644
--- a/src/osd/windows/winwork.c
+++ b/src/osd/windows/winwork.c
@@ -438,6 +438,11 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
return NULL;
item->event = NULL;
item->queue = queue;
+ item->done = FALSE;
+ }
+ else
+ {
+ atomic_exchange32(&item->done, FALSE); // needs to be set this way to prevent data race/usage of uninitialized memory on Linux
}
// fill in the basics
@@ -445,8 +450,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
item->callback = callback;
item->param = parambase;
item->result = NULL;
- item->flags = flags;
- atomic_exchange32(&item->done, FALSE);
+ item->flags = flags;
// advance to the next
lastitem = item;