<feed xmlns='http://www.w3.org/2005/Atom'>
<title>usbx.git/common/usbx_host_classes/src/ux_host_class_hid_entry.c, branch dev</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/usbx.git/atom/common/usbx_host_classes/src/ux_host_class_hid_entry.c?h=dev</id>
<link rel='self' href='http://cgit.235523.xyz/usbx.git/atom/common/usbx_host_classes/src/ux_host_class_hid_entry.c?h=dev'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/'/>
<updated>2026-06-04T20:57:57Z</updated>
<entry>
<title>fix(hid): fixed memory leak and double-free in keyboard/mouse/remote_control client lifecycle (#265)</title>
<updated>2026-06-04T20:57:57Z</updated>
<author>
<name>Frédéric Desbiens</name>
<email>frederic.desbiens@eclipse-foundation.org</email>
</author>
<published>2026-06-04T20:57:57Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/commit/?id=fa5ac39d6bfb5961cf1fb48c13e31e96c5665bdd'/>
<id>urn:sha1:fa5ac39d6bfb5961cf1fb48c13e31e96c5665bdd</id>
<content type='text'>
PR #262 introduced per-instance UX_HOST_CLASS_HID_CLIENT allocation in
client_search.c. However, keyboard/mouse/remote_control activate handlers
already embed a UX_HOST_CLASS_HID_CLIENT inside their own combined
allocation (e.g. UX_HOST_CLASS_HID_CLIENT_KEYBOARD), override
hid-&gt;hid_client with the embedded copy, and then free the entire combined
struct (as 'keyboard_instance', the first field) during deactivation.

This created two bugs:

1. Memory leak: the per-instance copy from client_search was abandoned
   when activate handlers replaced hid-&gt;hid_client with their embedded
   copy.

2. Double-free / UX_MEMORY_CORRUPTED: deactivate.c freed hid-&gt;hid_client
   after calling the handler, but for keyboard/mouse/remote_control the
   deactivate handler had already freed the entire combined allocation
   (which contains the embedded hid_client), causing a second free of a
   pointer into the middle of a now-freed block.

Fix:
- keyboard/mouse/remote_control activate: free the per-instance copy from
  client_search before overriding hid-&gt;hid_client with the embedded one.
- keyboard/mouse/remote_control deactivate: null hid-&gt;hid_client after
  freeing the combined struct, signalling that cleanup is done.
- deactivate.c: re-check hid_client != NULL after calling the handler
  before freeing; keyboard/mouse/remote_control will have nulled it,
  simple clients will not.
- keyboard/mouse ACTIVATE_WAIT error paths (standalone): null
  hid-&gt;hid_client after freeing the combined struct so that the generic
  cleanup in entry.c skips the already-freed pointer.
- entry.c standalone ACTIVATE_WAIT error: guard the free with a NULL
  check to safely handle both cases.

Discovered while investigating test failures introduced by PR #262.
All 430 tests pass after this fix.

Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>fix(hid): Store client instance per-device instead of per-class (#262)</title>
<updated>2026-06-04T20:03:06Z</updated>
<author>
<name>Kajtek Lau</name>
<email>kajtek.lau@gmail.com</email>
</author>
<published>2026-06-04T20:03:06Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/commit/?id=a5fd35face7c364b00fd2fdecbac0c3ca45f659b'/>
<id>urn:sha1:a5fd35face7c364b00fd2fdecbac0c3ca45f659b</id>
<content type='text'>
* fix(hid): Store client instance per-device instead of per-class

* Address review feedback on per-instance HID client copy

Three issues fixed, discovered during maintainer review:

1. Memory leak in standalone activation error path (entry.c):
   _ux_host_class_hid_client_activate_wait() set hid_client to NULL
   without freeing the per-instance copy allocated in client_search.
   The HID_ENUM_ERROR handler destroys the hid struct without freeing
   hid_client, so the copy was leaked on every standalone activation
   failure. Fixed by freeing hid_client before clearing it.

2. Variable declared inside if-block (client_search.c):
   hid_client_instance was declared inside the if (status == UX_SUCCESS)
   block, which is a C99 feature. USBX targets C89/C90 embedded
   toolchains. Moved to the top of the function with other locals.

3. Trailing whitespace throughout both changed files:
   The PR introduced trailing spaces on most comment-block lines.
   Reverted all affected lines to their original whitespace.

Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt;

---------

Co-authored-by: Frédéric Desbiens &lt;frederic.desbiens@eclipse-foundation.org&gt;
Co-authored-by: Copilot &lt;223556219+Copilot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Fixed issue where pointer size was used instead of buffer size in ux_host_class_hid_report_item_analyse</title>
<updated>2026-03-05T11:10:25Z</updated>
<author>
<name>Frédéric Desbiens</name>
<email>frederic.desbiens@eclipse-foundation.org</email>
</author>
<published>2026-03-05T11:10:25Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/commit/?id=46f65a3a5971a4310e7c5c2cf3ac513db67a89d5'/>
<id>urn:sha1:46f65a3a5971a4310e7c5c2cf3ac513db67a89d5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Updated copyright headers and removed trailing whitespace</title>
<updated>2026-03-05T09:02:41Z</updated>
<author>
<name>Frédéric Desbiens</name>
<email>frederic.desbiens@eclipse-foundation.org</email>
</author>
<published>2026-03-05T09:02:41Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/commit/?id=ea36a88e9fee4136b56e0b8faf94b9acf4c21761'/>
<id>urn:sha1:ea36a88e9fee4136b56e0b8faf94b9acf4c21761</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Update copyright.</title>
<updated>2024-01-29T06:21:32Z</updated>
<author>
<name>Bo Chen (from Dev Box)</name>
<email>boche@microsoft.com</email>
</author>
<published>2024-01-29T06:21:32Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/commit/?id=a6087c2efa17d10f67b450392218b68571a68d16'/>
<id>urn:sha1:a6087c2efa17d10f67b450392218b68571a68d16</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Release 6.1.12</title>
<updated>2022-07-26T02:07:18Z</updated>
<author>
<name>Yuxin Zhou</name>
<email>yuxzho@microsoft.com</email>
</author>
<published>2022-07-26T02:07:18Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/commit/?id=cd55ec74569aa3fbfbd8f02d025a47c5a51a285a'/>
<id>urn:sha1:cd55ec74569aa3fbfbd8f02d025a47c5a51a285a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Release 6.1.10</title>
<updated>2022-01-26T23:54:01Z</updated>
<author>
<name>Yuxin Zhou</name>
<email>yuxzho@microsoft.com</email>
</author>
<published>2022-01-26T23:54:01Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/commit/?id=8f56ef4e4492dd66c2161b7c1534c6f4442852a4'/>
<id>urn:sha1:8f56ef4e4492dd66c2161b7c1534c6f4442852a4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>6.1 Release</title>
<updated>2020-10-09T19:39:54Z</updated>
<author>
<name>Scott Larson</name>
<email>sclarson@microsoft.com</email>
</author>
<published>2020-10-09T19:39:54Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/commit/?id=3f1e20df866441bd7e3e8a45fffe1d5ab0413002'/>
<id>urn:sha1:3f1e20df866441bd7e3e8a45fffe1d5ab0413002</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Initial commit</title>
<updated>2020-05-11T15:03:23Z</updated>
<author>
<name>PProvost</name>
<email>peter@provost.org</email>
</author>
<published>2020-05-11T15:03:23Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/usbx.git/commit/?id=15044435fb627392d1b361e10ae9b2d54d76dec6'/>
<id>urn:sha1:15044435fb627392d1b361e10ae9b2d54d76dec6</id>
<content type='text'>
</content>
</entry>
</feed>
