summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/semaphorecreatesupp.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-18 06:23:27 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-21 07:29:38 +0200
commit90f1265e5dffe0f834ee9c55640a34fd90be8f12 (patch)
tree93be90c5b980b2be8d07eac95a9a50c539888cfa /cpukit/posix/src/semaphorecreatesupp.c
parentscore: Close barrier object before flush (diff)
downloadrtems-90f1265e5dffe0f834ee9c55640a34fd90be8f12.tar.bz2
score: Fix _CORE_semaphore_Flush()
Use proper CORE_semaphore_Status for _CORE_semaphore_Flush() and _CORE_semaphore_Destroy() operations. Close #2696.
Diffstat (limited to 'cpukit/posix/src/semaphorecreatesupp.c')
-rw-r--r--cpukit/posix/src/semaphorecreatesupp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cpukit/posix/src/semaphorecreatesupp.c b/cpukit/posix/src/semaphorecreatesupp.c
index 9a24e0a724..79db8888d8 100644
--- a/cpukit/posix/src/semaphorecreatesupp.c
+++ b/cpukit/posix/src/semaphorecreatesupp.c
@@ -54,11 +54,6 @@ int _POSIX_Semaphore_Create_support(
if (pshared != 0)
rtems_set_errno_and_return_minus_one( ENOSYS );
- the_semaphore = _POSIX_Semaphore_Allocate_unprotected();
- if ( !the_semaphore ) {
- rtems_set_errno_and_return_minus_one( ENOSPC );
- }
-
/*
* Make a copy of the user's string for name just in case it was
* dynamically constructed.
@@ -66,13 +61,18 @@ int _POSIX_Semaphore_Create_support(
if ( name_arg != NULL ) {
name = _Workspace_String_duplicate( name_arg, name_len );
if ( !name ) {
- _POSIX_Semaphore_Free( the_semaphore );
rtems_set_errno_and_return_minus_one( ENOMEM );
}
} else {
name = NULL;
}
+ the_semaphore = _POSIX_Semaphore_Allocate_unprotected();
+ if ( !the_semaphore ) {
+ _Workspace_Free( name );
+ rtems_set_errno_and_return_minus_one( ENOSPC );
+ }
+
the_semaphore->process_shared = pshared;
if ( name ) {