projects
/
project
/
netifd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
proto-shell: Model config parameter "no-proto-task" as a proto flag
[project/netifd.git]
/
proto.c
diff --git
a/proto.c
b/proto.c
index
eaec913
..
45eeb4b
100644
(file)
--- a/
proto.c
+++ b/
proto.c
@@
-101,6
+101,9
@@
alloc_device_addr(bool v6, bool ext)
struct device_addr *addr;
addr = calloc(1, sizeof(*addr));
struct device_addr *addr;
addr = calloc(1, sizeof(*addr));
+ if (!addr)
+ return NULL;
+
addr->flags = v6 ? DEVADDR_INET6 : DEVADDR_INET4;
if (ext)
addr->flags |= DEVADDR_EXTERNAL;
addr->flags = v6 ? DEVADDR_INET6 : DEVADDR_INET4;
if (ext)
addr->flags |= DEVADDR_EXTERNAL;
@@
-262,6
+265,9
@@
parse_gateway_option(struct interface *iface, struct blob_attr *attr, bool v6)
int af = v6 ? AF_INET6 : AF_INET;
route = calloc(1, sizeof(*route));
int af = v6 ? AF_INET6 : AF_INET;
route = calloc(1, sizeof(*route));
+ if (!route)
+ return NULL;
+
if (!inet_pton(af, str, &route->nexthop)) {
interface_add_error(iface, "proto", "INVALID_GATEWAY", &str, 1);
free(route);
if (!inet_pton(af, str, &route->nexthop)) {
interface_add_error(iface, "proto", "INVALID_GATEWAY", &str, 1);
free(route);
@@
-287,7
+293,7
@@
static bool
parse_prefix_option(struct interface *iface, const char *str, size_t len)
{
char buf[128] = {0}, *saveptr;
parse_prefix_option(struct interface *iface, const char *str, size_t len)
{
char buf[128] = {0}, *saveptr;
- if (len > sizeof(buf))
+ if (len >
=
sizeof(buf))
return false;
memcpy(buf, str, len);
return false;
memcpy(buf, str, len);
@@
-514,6
+520,9
@@
default_proto_attach(const struct proto_handler *h,
struct interface_proto_state *proto;
proto = calloc(1, sizeof(*proto));
struct interface_proto_state *proto;
proto = calloc(1, sizeof(*proto));
+ if (!proto)
+ return NULL;
+
proto->free = default_proto_free;
proto->cb = no_proto_handler;
proto->free = default_proto_free;
proto->cb = no_proto_handler;