Fix suspicius code for allocating a sockaddr_un to a sockaddr ptr
Remarked on by Coverity Scan. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
e1f9a1a566
commit
0555e0989f
@ -77,10 +77,13 @@ int socket_register(int sd, struct addrinfo *ai, void (*cb)(int, void *), void *
|
||||
goto err;
|
||||
|
||||
if (ai) {
|
||||
entry->ai.ai_addr = calloc(1, sizeof(struct sockaddr_un));
|
||||
if (!entry->ai.ai_addr)
|
||||
struct sockaddr_un *sun;
|
||||
|
||||
sun = calloc(1, sizeof(struct sockaddr_un));
|
||||
if (!sun)
|
||||
goto eaddr;
|
||||
|
||||
entry->ai.ai_addr = (struct sockaddr *)sun;
|
||||
entry->ai = *ai;
|
||||
*entry->ai.ai_addr = *ai->ai_addr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user