netlink-socket: Use xmalloc() instead of malloc().
authorBen Pfaff <blp@nicira.com>
Fri, 26 Apr 2013 21:15:37 +0000 (14:15 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 29 Apr 2013 22:05:56 +0000 (15:05 -0700)
This was the only obvious use of bare malloc() in the tree, other
than in the implementation of wrapper functions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/netlink-socket.c

index a9e68fa..fbb1724 100644 (file)
@@ -110,10 +110,7 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
     }
 
     *sockp = NULL;
-    sock = malloc(sizeof *sock);
-    if (sock == NULL) {
-        return ENOMEM;
-    }
+    sock = xmalloc(sizeof *sock);
 
     sock->fd = socket(AF_NETLINK, SOCK_RAW, protocol);
     if (sock->fd < 0) {