Re: [PATCH 2/2] check_expirations: don't copy over same element

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 16, 2011 at 01:51:35PM +0200, Thomas Rast wrote:

> diff --git a/credential-cache--daemon.c b/credential-cache--daemon.c
> index d6769b1..128c5ce 100644
> --- a/credential-cache--daemon.c
> +++ b/credential-cache--daemon.c
> @@ -77,7 +77,8 @@ static int check_expirations(void)
>  			free(entries[i].item.unique);
>  			free(entries[i].item.username);
>  			free(entries[i].item.password);
> -			memcpy(&entries[i], &entries[entries_nr], sizeof(*entries));
> +			if (i != entries_nr)
> +				memcpy(&entries[i], &entries[entries_nr], sizeof(*entries));

Thanks. I even remember while writing this loop considering the case of
(i == entries_nr), but decided it didn't need special-casing. But I
obviously forgot about memcpy.

Both this and the prior patch are:

Acked-by: Jeff King <peff@xxxxxxxx>

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]