[ovs-dev] [PATCH 2/2] netlink-socket: Use xmalloc() instead of malloc().
Justin Pettit
jpettit at nicira.com
Mon Apr 29 22:04:06 UTC 2013
Both look good to me.
--Justin
On Apr 29, 2013, at 3:00 PM, Ben Pfaff <blp at nicira.com> wrote:
> 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 at nicira.com>
> ---
> lib/netlink-socket.c | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
> index a9e68fa..fbb1724 100644
> --- a/lib/netlink-socket.c
> +++ b/lib/netlink-socket.c
> @@ -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) {
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list