chiark / gitweb /
network-internal: initialize _cleanup_ variable
[elogind.git] / src / libsystemd-network / network-internal.c
index a5db0c53530282f1ba291cae6a731298a3d01964..7a7a4eac9d505cb0605b6c9f64e16cbfe8a10a0c 100644 (file)
@@ -465,7 +465,7 @@ int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t
 
         FOREACH_WORD(word, len, string, state) {
                 /* WORD FORMAT: dst_ip/dst_prefixlen,gw_ip */
-                _cleanup_free_ char* entry;
+                _cleanup_free_ char* entry = NULL;
                 char *tok, *tok_end;
                 unsigned n;
                 int r;
@@ -474,6 +474,8 @@ int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t
                         return -ENOMEM;
 
                 entry = strndup(word, len);
+                if(!entry)
+                        return -ENOMEM;
 
                 tok = entry;