Fix memmove size
authorGeoff Levand <geoffrey.levand@am.sony.com>
Sun, 12 Apr 2009 15:11:37 +0000 (15:11 +0000)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 30 Jun 2009 07:28:55 +0000 (15:28 +0800)
Correct the byte count for several memmove calls.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/waiter/waiter.c
ui/common/discover-client.c

index 214dfda0b4786d7d42293e7ff25c406c7528814a..68f483acac03adaea7955cf91dd1fc2f2197a75a 100644 (file)
@@ -43,7 +43,8 @@ void waiter_remove(struct waiter *waiter)
        assert(i >= 0 && i < n_waiters);
 
        n_waiters--;
-       memmove(&waiters[i], &waiters[i+1], n_waiters - i);
+       memmove(&waiters[i], &waiters[i+1],
+               (n_waiters - i) * sizeof(waiters[0]));
 
        waiters = talloc_realloc(NULL, waiters, struct waiter, n_waiters);
 }
index b1ef440a9127e927f3e6456fb25688248f05ecc7..e8ce4dd91bda53c88230441d32815eb20ad44e0f 100644 (file)
@@ -111,7 +111,7 @@ static void device_remove(struct discover_client *client, const char *id)
        /* remove the device from the client's device array */
        client->n_devices--;
        memmove(&client->devices[i], &client->devices[i+1],
-                       client->n_devices - i);
+                       (client->n_devices - i) * sizeof(client->devices[0]));
        client->devices = talloc_realloc(client, client->devices,
                        struct device *, client->n_devices);