[PR #13] [CLOSED] hid.c: Fix reinitialization after an error #12

Closed
opened 2026-02-15 15:54:31 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RPCS3/hidapi/pull/13
Author: @elad335
Created: 4/3/2024
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • ef7be3c hid.c: Fix reinitialization after an error

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 linux/hid.c (+2 -2)

📄 Description

This should fix the crashes I experienced whenever DuelSense and DuelShock 4 got disconnected from bluetooth, either by battery shortage or manual shutdown from the controller.
The bug occured because data from the stack was used instead of dynamic memory to output the error after device connection errors, upon reinitialization (in an attempt to reconnect with the controller) the function got called again to clean the error buffer, but it called the C function free with an invalid pointer.
The crash occured inside of the free function.


🔄 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/RPCS3/hidapi/pull/13 **Author:** [@elad335](https://github.com/elad335) **Created:** 4/3/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`ef7be3c`](https://github.com/RPCS3/hidapi/commit/ef7be3c31f535ab97504cede19d883e216d7108d) hid.c: Fix reinitialization after an error ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `linux/hid.c` (+2 -2) </details> ### 📄 Description This should fix the crashes I experienced whenever DuelSense and DuelShock 4 got disconnected from bluetooth, either by battery shortage or manual shutdown from the controller. The bug occured because data from the stack was used instead of dynamic memory to output the error after device connection errors, upon reinitialization (in an attempt to reconnect with the controller) the function got called again to clean the error buffer, but it called the C function `free` with an invalid pointer. The crash occured inside of the `free` function. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 15:54:31 -05:00
yindo closed this issue 2026-02-15 15:54:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: RPCS3/hidapi#12