opt: fix opt_unregister.
[ccan] / ccan / opt / opt.c
index d4601dfbb230a3076edfa64d8b5232996f4d59d2..d376a598da932445de592c8f12e2466d4bc431bd 100644 (file)
@@ -189,7 +189,8 @@ bool opt_unregister(const char *names)
        if (found == -1)
                return false;
        opt_count--;
-       memmove(&opt_table[found], &opt_table[found+1], opt_count - found);
+       memmove(&opt_table[found], &opt_table[found+1],
+               (opt_count - found) * sizeof(opt_table[found]));
        return true;
 }