if (msg->msg_flags&MSG_OOB)
                return -EOPNOTSUPP;
 
-       if (NULL == siocb->scm)
+       if (NULL == siocb->scm) {
                siocb->scm = &scm;
+               memset(&scm, 0, sizeof(scm));
+       }
        err = scm_send(sock, msg, siocb->scm);
        if (err < 0)
                return err;
 
        if (msg->msg_namelen) {
+               err = -EINVAL;
                if (addr->nl_family != AF_NETLINK)
-                       return -EINVAL;
+                       goto out;
                dst_pid = addr->nl_pid;
                dst_group = ffs(addr->nl_groups);
+               err =  -EPERM;
                if (dst_group && !netlink_capable(sock, NL_NONROOT_SEND))
-                       return -EPERM;
+                       goto out;
        } else {
                dst_pid = nlk->dst_pid;
                dst_group = nlk->dst_group;
        err = netlink_unicast(sk, skb, dst_pid, msg->msg_flags&MSG_DONTWAIT);
 
 out:
+       scm_destroy(siocb->scm);
        return err;
 }