Skip to content

Segmentation fault in void __cleanup_context(rcl_context_t * context) #539

@BorjaOuterelo

Description

@BorjaOuterelo

Bug report

Required Info:

  • Operating System:
    • Ubuntu 18.04.
  • Installation type:
    • Binaries.
  • Version or commit hash:
    • Dashing, Eloquent, Master.
  • DDS implementation:
    • Custom. N/A.
  • Client library (if applicable):
    • N/A.

Steps to reproduce issue

  rcl_ret_t rv;

  rcl_init_options_t options = rcl_get_zero_initialized_init_options();
  rv = rcl_init_options_init(&options, rcl_get_default_allocator());
  if (RCL_RET_OK != rv) {
    printf("rcl init options error: %s\n", rcl_get_error_string().str);
    return 1;
  }

  rcl_context_t context = rcl_get_zero_initialized_context();
  rv = rcl_init(argc, argv, &options, &context);

Above code in combination with a 'rmw_init` implementation which returns something that is not RMW_RET_OK,

Expected behaviour

It should fail gently setting errors accordingly.

Actual behavior

Segmentation fault in:

allocator.deallocate(context->impl->argv[i], allocator.state);

Additional information

The dump is generated due to allocator being 0.

Combination of

goto fail;

but it is setting the allocators in a different line.

context->impl->allocator = allocator;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions