socket_address_flatten() leaks a SocketAddress when its argument is
null. Happens when opening a ChardevBackend of type 'udp' that is
configured without a local address. Screwed up in commit
bd269ebc due
to last minute semantic conflict resolution. Spotted by Coverity.
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <
1494866344[email protected]>
Reviewed-by: Eric Blake <[email protected]>
SocketAddress *socket_address_flatten(SocketAddressLegacy *addr_legacy)
{
- SocketAddress *addr = g_new(SocketAddress, 1);
+ SocketAddress *addr;
if (!addr_legacy) {
return NULL;
}
+ addr = g_new(SocketAddress, 1);
+
switch (addr_legacy->type) {
case SOCKET_ADDRESS_LEGACY_KIND_INET:
addr->type = SOCKET_ADDRESS_TYPE_INET;