]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix more clang analyzer errors.
authorRoy Marples <roy@marples.name>
Thu, 11 Sep 2014 11:37:10 +0000 (11:37 +0000)
committerRoy Marples <roy@marples.name>
Thu, 11 Sep 2014 11:37:10 +0000 (11:37 +0000)
if-linux.c
script.c

index 61bfd9b09205e9b1db1228432ad3f65edcbc3b1a..f4a6265d1ccc44b1aa519b265aebf72daa53708a 100644 (file)
@@ -375,9 +375,11 @@ get_netlink(struct dhcpcd_ctx *ctx, struct interface *ifp, int fd, int flags,
                                goto eexit;
                        if (r)
                                continue;
-                       r = callback(ctx, ifp, nlm);
-                       if (r != 0)
-                               goto eexit;
+                       if (callback) {
+                               r = callback(ctx, ifp, nlm);
+                               if (r != 0)
+                                       goto eexit;
+                       }
                }
        }
 
@@ -784,7 +786,8 @@ add_attr_l(struct nlmsghdr *n, unsigned short maxlen, unsigned short type,
        rta = NLMSG_TAIL(n);
        rta->rta_type = type;
        rta->rta_len = len;
-       memcpy(RTA_DATA(rta), data, alen);
+       if (alen)
+               memcpy(RTA_DATA(rta), data, alen);
        n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len);
 
        return 0;
index c931d3bae800d72811179a554f60ea5400a590d9..4ff6823d5e0087ff853eba9f8d2171236d6b0933 100644 (file)
--- a/script.c
+++ b/script.c
@@ -692,6 +692,7 @@ script_runreason(const struct interface *ifp, const char *reason)
 
        /* Send to our listeners */
        bigenv = NULL;
+       status = 0;
        TAILQ_FOREACH(fd, &ifp->ctx->control_fds, next) {
                if (!fd->listener)
                        continue;
@@ -706,7 +707,11 @@ script_runreason(const struct interface *ifp, const char *reason)
                }
                if (control_queue(fd, bigenv, elen, 1) == -1)
                        syslog(LOG_ERR, "%s: control_queue: %m", __func__);
+               else
+                       status = 1;
        }
+       if (!status)
+               free(bigenv);
 
 out:
        /* Cleanup */