[PR #243] fix: free partial junk spec allocations on setup failure #255

Open
opened 2026-10-13 21:08:03 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/pull/243
Author: @HeisLuka
Created: 9/14/2026
Status: 🔄 Open

Base: master ← Head: fix/jp-spec-allocation-cleanup


📝 Commits (1)

  • 15fb0b1 fix: free partial junk spec allocations on setup failure

📊 Changes

1 file changed (+8 additions, -0 deletions)

View changed files

📝 src/junk.c (+8 -0)

📄 Description

Summary

Fix a partial allocation leak in jp_spec_setup().

spec->pkt and spec->mods are allocated separately. If one allocation succeeds
and the other fails, the function returns -ENOMEM without freeing the
successful allocation.

This change cleans up both buffers on the error path and resets the associated
pointers and sizes, leaving the jp_spec in a consistent empty state.

Scope

This only changes the allocation-failure path. Successful junk spec setup and
packet generation are unchanged.

Fixes #102


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/pull/243 **Author:** [@HeisLuka](https://github.com/HeisLuka) **Created:** 9/14/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix/jp-spec-allocation-cleanup` --- ### 📝 Commits (1) - [`15fb0b1`](https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/commit/15fb0b13de7844001165ec4321e98f6ec1346cb8) fix: free partial junk spec allocations on setup failure ### 📊 Changes **1 file changed** (+8 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/junk.c` (+8 -0) </details> ### 📄 Description ## Summary Fix a partial allocation leak in `jp_spec_setup()`. `spec->pkt` and `spec->mods` are allocated separately. If one allocation succeeds and the other fails, the function returns `-ENOMEM` without freeing the successful allocation. This change cleans up both buffers on the error path and resets the associated pointers and sizes, leaving the `jp_spec` in a consistent empty state. ## Scope This only changes the allocation-failure path. Successful junk spec setup and packet generation are unchanged. Fixes #102 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-linux-kernel-module#255
No description provided.