Commit e7905855 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

vxworks/mempart: fix error status upon failure to create partition

Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 903b21fe
......@@ -48,17 +48,21 @@ PART_ID memPartCreate(char *pPool, unsigned int poolSize)
pthread_mutexattr_t mattr;
struct wind_mempart *mp;
struct service svc;
int ret;
CANCEL_DEFER(svc);
mp = xnmalloc(sizeof(*mp));
if (mp == NULL)
if (mp == NULL) {
errno = S_memLib_NOT_ENOUGH_MEMORY;
goto fail;
}
if (__heapobj_init(&mp->hobj, NULL, poolSize, pPool)) {
ret = __heapobj_init(&mp->hobj, NULL, poolSize, pPool);
if (ret) {
xnfree(mp);
errno = S_memLib_INVALID_NBYTES;
fail:
errno = S_memLib_NOT_ENOUGH_MEMORY;
CANCEL_RESTORE(svc);
return (PART_ID)0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment