Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS_API_Init() does not correct cleanup resources on error #171

Closed
skliper opened this issue Sep 30, 2019 · 3 comments
Closed

OS_API_Init() does not correct cleanup resources on error #171

skliper opened this issue Sep 30, 2019 · 3 comments

Comments

@skliper
Copy link
Contributor

skliper commented Sep 30, 2019

OS_API_Init initializes several OS primitives but is made with a pattern of exiting as soon as any initialization fails without cleaning up previous successful initializations. For example:

OS_task_table_sem = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE );
if ( OS_task_table_sem == NULL )
{
return(OS_ERROR);
}

OS_queue_table_sem = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE );
if ( OS_queue_table_sem == NULL )
{
return(OS_ERROR);
}

If OS_task_table_sem successfully initializes, but OS_queue_table_sem does not, then OS_task_table_sem will become a leaked resource.

@skliper skliper self-assigned this Sep 30, 2019
@skliper skliper added the bug label Sep 30, 2019
@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Imported from trac issue 148. Created by sseeger on 2016-01-10T01:01:51, last modified: 2019-08-14T14:11:46

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by sseeger on 2016-01-11 13:49:13:

This ticket is relevant to at least the vxWorks implementation

@skliper skliper removed their assignment Sep 30, 2019
@skliper
Copy link
Contributor Author

skliper commented Oct 22, 2019

Now calling CFE_PSP_Panic for any OS_API_Init failure, which is documented as "irrecoverable". No clean-up is really applicable.

@skliper skliper closed this as completed Oct 22, 2019
jphickey added a commit to jphickey/osal that referenced this issue Apr 7, 2021
Invoke OS_API_Teardown to reset state for next test
jphickey added a commit to jphickey/osal that referenced this issue Apr 7, 2021
Invoke OS_API_Teardown to reset state for next test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant