Skip to content

Commit ae5ce25

Browse files
Sackzementslouken
authored andcommitted
Fix double-free warning in src/hidapi/linux/hid.c
1 parent 2b94062 commit ae5ce25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/hidapi/linux/hid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ static wchar_t *utf8_to_wchar_t(const char *utf8)
134134
* Use register_error_str(NULL) to free the error message completely. */
135135
static void register_error_str(wchar_t **error_str, const char *msg)
136136
{
137-
free(*error_str);
138137
#ifdef HIDAPI_USING_SDL_RUNTIME
139138
/* Thread-safe error handling */
140139
if (msg) {
@@ -143,6 +142,7 @@ static void register_error_str(wchar_t **error_str, const char *msg)
143142
SDL_ClearError();
144143
}
145144
#else
145+
free(*error_str);
146146
*error_str = utf8_to_wchar_t(msg);
147147
#endif
148148
}

0 commit comments

Comments
 (0)