Fix some clang analyzer warnings.
authorRoy Marples <roy@marples.name>
Thu, 11 Sep 2014 10:48:49 +0000 (10:48 +0000)
committerRoy Marples <roy@marples.name>
Thu, 11 Sep 2014 10:48:49 +0000 (10:48 +0000)
src/libdhcpcd/config.c
src/libdhcpcd/dhcpcd.c

index d17fd0d462cc809b8546a33552ca38570de824d5..709a8e841c068f6950655b10c896717c2ac0c6c9 100644 (file)
@@ -177,6 +177,7 @@ dhcpcd_config_set1(DHCPCD_OPTION **config, const char *opt, const char *val,
                        o = dhcpcd_option_new("static", t);
                else
                        o = dhcpcd_option_new(opt, val);
+               free(t);
                if (o == NULL)
                        return false;
                if (l == NULL)
index 87539340303c4f07ddc47f4a53e3ab08ddf0cba3..919c8ffd0f8fd3c9cf79c7aa430e6f6c7df87dda 100644 (file)
@@ -803,9 +803,9 @@ dhcpcd_if_message(DHCPCD_IF *i, bool *new_msg)
        if (showssid)
                p += snprintf(p, len - (size_t)(p - msg), " %s", i->ssid);
        if (iplen)
-               p += snprintf(p, len - (size_t)(p - msg), " %s/%s", ip, iplen);
+               snprintf(p, len - (size_t)(p - msg), " %s/%s", ip, iplen);
        else if (ip)
-               p += snprintf(p, len - (size_t)(p - msg), " %s", ip);
+               snprintf(p, len - (size_t)(p - msg), " %s", ip);
 
        if (new_msg) {
                if (i->last_message == NULL || strcmp(i->last_message, msg))