chiark / gitweb /
shared/socket-util: kill gcc warning about uninitialized variable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 31 Oct 2012 20:44:54 +0000 (21:44 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 13 Nov 2012 01:23:02 +0000 (02:23 +0100)
The warning was invalid, but distracting.

src/shared/socket-util.c

index 8bc3729..49ea758 100644 (file)
@@ -363,13 +363,12 @@ int socket_address_print(const SocketAddress *a, char **p) {
         }
 
         case AF_NETLINK: {
         }
 
         case AF_NETLINK: {
-                char *sfamily;
+                char _cleanup_free_ *sfamily = NULL;
 
                 r = netlink_family_to_string_alloc(a->protocol, &sfamily);
                 if (r < 0)
                         return r;
                 r = asprintf(p, "%s %u", sfamily, a->sockaddr.nl.nl_groups);
 
                 r = netlink_family_to_string_alloc(a->protocol, &sfamily);
                 if (r < 0)
                         return r;
                 r = asprintf(p, "%s %u", sfamily, a->sockaddr.nl.nl_groups);
-                free(sfamily);
 
                 return 0;
         }
 
                 return 0;
         }