}
int in_addr_ifindex_from_string_auto(const char *s, int *family, union in_addr_union *ret, int *ifindex) {
+ _cleanup_free_ char *buf = NULL;
const char *suffix;
int r, ifi = 0;
}
}
- s = strndupa(s, suffix - s);
+ buf = strndup(s, suffix - s);
+ if (!buf)
+ return -ENOMEM;
+
+ s = buf;
}
r = in_addr_from_string_auto(s, family, ret);
union in_addr_union *ret_prefix,
unsigned char *ret_prefixlen) {
+ _cleanup_free_ char *str = NULL;
union in_addr_union buffer;
const char *e, *l;
unsigned char k;
return -EAFNOSUPPORT;
e = strchr(p, '/');
- if (e)
- l = strndupa(p, e - p);
- else
+ if (e) {
+ str = strndup(p, e - p);
+ if (!str)
+ return -ENOMEM;
+
+ l = str;
+ } else
l = p;
r = in_addr_from_string(family, l, &buffer);
union in_addr_union *ret_prefix,
unsigned char *ret_prefixlen) {
+ _cleanup_free_ char *str = NULL;
union in_addr_union buffer;
const char *e, *l;
unsigned char k;
assert(p);
e = strchr(p, '/');
- if (e)
- l = strndupa(p, e - p);
- else
+ if (e) {
+ str = strndup(p, e - p);
+ if (!str)
+ return -ENOMEM;
+
+ l = str;
+ } else
l = p;
r = in_addr_from_string_auto(l, &family, &buffer);