• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RobotWebTools / rclnodejs / 22702484015
86%

Build:
DEFAULT BRANCH: develop
Ran 05 Mar 2026 04:48AM UTC
Jobs 1
Files 50
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

05 Mar 2026 04:35AM UTC coverage: 85.481%. Remained the same
22702484015

push

github

web-flow
Fix: resolve memory leaks, use-after-free, and correctness issues in … (#1408)

Comprehensive audit and fix of all C++ source files under `src/` that implement
N-API bindings for the ROS2 rcl library. Five categories of issues were
identified and resolved.

### 1. Use-after-free in context deleter lambda

**File:** `src/rcl_context_bindings.cpp`

Changed `[&env]` capture to `[env]` in the lambda deleter passed to
`RclHandle`. Since `Napi::Env` is a lightweight pointer wrapper, capturing by
value copies the `napi_env` pointer safely. Capturing by reference created a
dangling reference because the lambda outlives the stack frame where `env` was
declared — the deleter runs during garbage collection, long after
`CreateContext` returns.

### 2. Memory leaks on early-return error paths

**Files:** 9 binding files

When `rcl_*_init()` fails, the previously `malloc`'d handle was not freed
before throwing and returning. Added `free()` calls before the error throw in:

- `src/rcl_node_bindings.cpp` — `CreateNode`
- `src/rcl_publisher_bindings.cpp` — `CreatePublisher`
- `src/rcl_timer_bindings.cpp` — `CreateTimer` (both `ROS_VERSION > 2305` branches)
- `src/rcl_guard_condition_bindings.cpp` — `CreateGuardCondition`
- `src/rcl_client_bindings.cpp` — `CreateClient`
- `src/rcl_service_bindings.cpp` — `CreateService`
- `src/rcl_action_client_bindings.cpp` — `ActionCreateClient`
- `src/rcl_action_server_bindings.cpp` — `ActionCreateServer`
- `src/rcl_lifecycle_bindings.cpp` — `CreateLifecycleStateMachine` (all 3 version branches)

### 3. Missing return after throw

**File:** `src/rcl_type_description_service_bindings.cpp`

Added `free(service)` and `return env.Undefined()` after
`ThrowAsJavaScriptException()` on init failure. Without the return, execution
continued and wrapped the uninitialized handle into an `RclHandle`, which would
later attempt to finalize invalid memory.

### 4. Static variable not reset between calls

**File:** `src/executor.cpp`

Added `handle_... (continued)

1380 of 1755 branches covered (78.63%)

Branch coverage included in aggregate %.

2859 of 3204 relevant lines covered (89.23%)

459.42 hits per line

Jobs
ID Job ID Ran Files Coverage
1 22702484015.1 05 Mar 2026 04:48AM UTC 50
85.48
GitHub Action Run
Source Files on build 22702484015
  • Tree
  • List 50
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #22702484015
  • 55ec8f0c on github
  • Prev Build on develop (#22699741741)
  • Next Build on develop (#22704446385)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc