Revert "sd-netlink: prepare buffer for dropping unexpected message"

This reverts commit bf478dcffb.

I think we should avoid allocating memory needlessly just to free it
again, in particular if this can be triggered by some rogue peer.
This commit is contained in:
Lennart Poettering
2025-04-17 08:25:40 +02:00
parent bf478dcffb
commit 6d88e4a4b4
@@ -181,12 +181,6 @@ static int socket_recv_message(int fd, void *buf, size_t buf_size, uint32_t *ret
log_debug("sd-netlink: ignoring message from PID %"PRIu32, sender.nl.nl_pid);
if (peek) {
_cleanup_free_ uint8_t *b = new(uint8_t, n);
if (!b)
return -ENOMEM;
iov = IOVEC_MAKE(b, n);
/* drop the message */
n = recvmsg_safe(fd, &msg, 0);
if (n < 0)