Skip to content

virtio-snd: Fix dynamic memory allocation for PCM I/O frames - #119

Merged
jserv merged 1 commit into
sysprog21:masterfrom
Cuda-Chen:fix-tx-mem-manage
Jan 2, 2026
Merged

jserv merged 1 commit into
sysprog21:masterfrom
Cuda-Chen:fix-tx-mem-manage

Conversation

@Cuda-Chen

@Cuda-Chen Cuda-Chen commented Jan 2, 2026

Copy link
Copy Markdown
Collaborator

Fix the PCM I/O transfer mechanism when allocating memory during frame enqueuing and freeing it upon dequeuing.


Summary by cubic

Fixes PCM TX frame memory handling in virtio-snd by deep-copying enqueued payloads and freeing buffers on dequeue. Prevents audio artifacts and memory leaks during PCM I/O.

  • Bug Fixes
    • Allocate node and its buffer with null checks; copy payload into owned memory.
    • Free node->addr and node when the frame is fully consumed.
    • Ensure the mutex unlocks on allocation failures via a single exit path.
    • Removes payload pointer reuse that caused repeating audio artifacts.

Written for commit d52d30c. Summary will update on new commits.

@Cuda-Chen
Cuda-Chen marked this pull request as ready for review January 2, 2026 08:00
@Cuda-Chen
Cuda-Chen requested a review from jserv January 2, 2026 08:00

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Comment thread virtio-snd.c Outdated
Fix the PCM I/O transfer mechanism when allocating memory during
frame enqueuing and freeing it upon dequeuing.
@Cuda-Chen
Cuda-Chen requested a review from jserv January 2, 2026 08:31
@jserv
jserv merged commit bcc3c7b into sysprog21:master Jan 2, 2026
5 checks passed
@jserv

jserv commented Jan 2, 2026

Copy link
Copy Markdown
Collaborator

Thank @Cuda-Chen for contributing!

@Cuda-Chen
Cuda-Chen deleted the fix-tx-mem-manage branch January 2, 2026 08:33
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