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

UCS/UCT: Fix issues found by coverity. #18

Merged
merged 1 commit into from
Nov 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/ucs/debug/memtrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,14 @@ void *ucs_memtrack_mmap(void *addr, size_t length, int prot, int flags,
int fd, off_t offset UCS_MEMTRACK_ARG)
{
ucs_memtrack_buffer_t *res;

if ((flags & MAP_FIXED) || !(prot & PROT_WRITE)) {
return NULL;
return MAP_FAILED;
}

res = mmap(addr, length + (ucs_memtrack_context.enabled ? sizeof(*res) : 0),
prot, flags, fd, offset);
if ((res == NULL) || (!ucs_memtrack_context.enabled)) {
if ((res == MAP_FAILED) || (!ucs_memtrack_context.enabled)) {
return res;
}

Expand Down
11 changes: 10 additions & 1 deletion src/uct/tl/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,27 @@ ucs_status_t uct_init(uct_context_h *context_p)
uct_context_t *context;

context = ucs_malloc(ucs_components_total_size(uct_context_t), "uct context");
if (context == NULL) {
status = UCS_ERR_NO_MEMORY;
goto err;
}

context->num_tls = 0;
context->tls = NULL;
ucs_notifier_chain_init(&context->progress_chain);

status = ucs_components_init_all(uct_context_t, context);
if (status != UCS_OK) {
return status;
goto err_free;
}

*context_p = context;
return UCS_OK;

err_free:
ucs_free(context);
err:
return status;
}

void uct_cleanup(uct_context_h context)
Expand Down