Skip to content

Add a new CodeQL query to check free of structures#2097

Merged
bettio merged 1 commit intoatomvm:mainfrom
pguyot:w07/add-codeql-test-free
Feb 13, 2026
Merged

Add a new CodeQL query to check free of structures#2097
bettio merged 1 commit intoatomvm:mainfrom
pguyot:w07/add-codeql-test-free

Conversation

@pguyot
Copy link
Collaborator

@pguyot pguyot commented Feb 13, 2026

Some structures in the code are never malloc'd or calloc'd because they are abstract types (struct ListHead or struct Monitor). Add a new CodeQL query to report and detect them. Fix correct (because of alignment) but dangerous cases with temporary variable that holds the allocated structure and that are likely to be optimized out by compiler. Also fix two bugs where resource pointers were freed in error paths while they shouldn't have.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

Some structures in the code are never malloc'd or calloc'd because they
are abstract types (struct ListHead or struct Monitor). Add a new CodeQL
query to report and detect them. Fix correct (because of alignment) but
dangerous cases with temporary variable that holds the allocated structure
and that are likely to be optimized out by compiler. Also fix two bugs where
resource pointers were freed in error paths while they shouldn't have.

Signed-off-by: Paul Guyot <pguyot@kallisys.net>
@bettio bettio merged commit a7f09d5 into atomvm:main Feb 13, 2026
222 of 226 checks passed
@pguyot pguyot deleted the w07/add-codeql-test-free branch February 13, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants