From 315db1a8aed226a51a4cf700172249cfd10ae115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 14 Mar 2014 09:05:56 -0400 Subject: [PATCH] Do not return -1 (EINVAL) on allocation error --- src/core/socket.c | 8 +++----- diff --git src/core/socket.c src/core/socket.c index 8ecc9f9..b39bec2 100644 --- src/core/socket.c +++ src/core/socket.c @@ -198,16 +198,14 @@ static int socket_instantiate_service(Socket *s) { assert(s->accept); - if (!(prefix = unit_name_to_prefix(UNIT(s)->id))) + prefix = unit_name_to_prefix(UNIT(s)->id); + if (!prefix) return -ENOMEM; - r = asprintf(&name, "%s@%u.service", prefix, s->n_accepted); - - if (r < 0) + if (asprintf(&name, "%s@%u.service", prefix, s->n_accepted) < 0) return -ENOMEM; r = manager_load_unit(UNIT(s)->manager, name, NULL, NULL, &u); - if (r < 0) return r; -- 1.7.9.2