Skip to content

Commit

Permalink
memleak: Leaks a few bytes of memory when you call it with an unknown…
Browse files Browse the repository at this point in the history
… error code
  • Loading branch information
zhuzhihai authored and xiaoxiang781216 committed Jan 14, 2025
1 parent 5bd3046 commit 5041f4f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/uv-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,10 @@ uv_buf_t uv_buf_init(char* base, unsigned int len) {


static const char* uv__unknown_err_code(int err) {
char buf[32];
char* copy;
static char buf[32];

snprintf(buf, sizeof(buf), "Unknown system error %d", err);
copy = uv__strdup(buf);

return copy != NULL ? copy : "Unknown system error";
return buf;
}

#define UV_ERR_NAME_GEN_R(name, _) \
Expand Down

0 comments on commit 5041f4f

Please sign in to comment.