Bug: client_cli.c may free() a string literal for server_host #166
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
client_cli.cdeclareschar* server_host = "127.0.0.1";at file scope. When the user provides--server-host, the code doesfree(server_host);and assigns a newly allocated string. Ifserver_hostis never reassigned (the common case), nofree()is called, so the literal is safe. However, the pattern is fragile: any future change that frees the default value would invoke undefined behavior.Location
src/client/client_cli.c:14—server_hostinitialized to a string literal.src/client/client_cli.c:160—free(server_host);before reassignment.Suggested fix
server_hostwithstr_dup("127.0.0.1")so it is always heap-allocated.server_hostis freed during cleanup.Severity
Low
Category
bug, quality
This issue was automatically generated by the issue-creator agent.