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

Qiskit / qiskit / 36406736678
88%

Build:
DEFAULT BRANCH: main
Ran 28 Sep 2026 10:22AM UTC
Jobs 1
Files 980
Run time 3min
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

28 Sep 2026 09:31AM UTC coverage: 88.114% (+0.009%) from 88.105%
36406736678

push

github

web-flow
Make null-freeing uniform across the C API `qk_*_free` functions (#17067)

* Make null-freeing uniform across the C API `qk_*_free` functions

The C API's `qk_*_free` functions all accept a null pointer and do nothing
with it, but their safety documentation says that in three different ways.
One group states null is fine, a second requires a "valid, non-null
pointer" -- which reads as undefined behavior on null -- and `qk_str_free`
and `qk_control_flow_instruction_free` never mention null at all.  The
implementations are consistent; only the documentation is not.  Twelve of
the thirteen free functions already refuse null, using the guard that
`crates/cext/src/pointers.rs` documents as the canonical template for the
crate.

That inconsistency matters most to bindings that free in a destructor or
finalizer, which routinely reach a free call with a pointer that may be
null: an object whose construction failed, or an optional out-parameter
that was never written.  Whether that is legal currently depends on which
of the three wordings a given function happens to use, so the safe move is
to add a null check at every call site even where the implementation
already has one.  Qiskit.jl calls `qk_str_free` with a null pointer after
every successful transpile, because the error-string out-parameter is only
written on failure.  That has never misbehaved, but the documentation says
it is undefined.

Adopt the "either null or a valid pointer" wording for every free
function: update the four docstrings that currently claim null is
undefined behavior, and add an explicit null sentence to the two that are
silent on it.  `qk_control_flow_instruction_free` is also the one free
function that does not guard -- it passes the pointer straight to
`Box::from_raw` -- so null is genuinely undefined there; give it the same
guard as the rest of the crate.  That makes the guarantee uniform rather
than something callers check function by function.  A unit test calls it
with a null ... (continued)

8 of 8 new or added lines in 1 file covered. (100.0%)

12 existing lines in 2 files now uncovered.

122374 of 138882 relevant lines covered (88.11%)

944055.3 hits per line

Coverage Regressions

Lines Coverage ∆ File
6
92.03
-0.26% crates/qasm2/src/lex.rs
6
97.66
0.47% crates/qasm2/src/parse.rs
Jobs
ID Job ID Ran Files Coverage
1 36406736678.1 28 Sep 2026 10:22AM UTC 980
88.11
GitHub Action Run
Source Files on build 36406736678
  • Tree
  • List 980
  • Changed 8
  • Source Changed 5
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #36406736678
  • cda8ca4f on github
  • Prev Build on gh-readonly-queue/main/pr-17053-2c10b688b7614b350ebdeb277c5e588ed0e3b0dc (#36197534451)
  • Next Build on main (#36406920982)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc