modules: Fix bad sizeofs.

This commit is contained in:
Jilles Tjoelker 2014-02-23 22:39:42 +01:00
parent 5ef68b1398
commit 1e170010e7

View file

@ -224,7 +224,7 @@ load_all_modules(int warn)
modules_init(); modules_init();
modlist = (struct module **) rb_malloc(sizeof(struct module) * (MODS_INCREMENT)); modlist = (struct module **) rb_malloc(sizeof(struct module *) * (MODS_INCREMENT));
max_mods = MODS_INCREMENT; max_mods = MODS_INCREMENT;
@ -739,7 +739,7 @@ unload_one_module(const char *name, int warn)
rb_free(modlist[modindex]->name); rb_free(modlist[modindex]->name);
memmove(&modlist[modindex], &modlist[modindex + 1], memmove(&modlist[modindex], &modlist[modindex + 1],
sizeof(struct module) * ((num_mods - 1) - modindex)); sizeof(struct module *) * ((num_mods - 1) - modindex));
if(num_mods != 0) if(num_mods != 0)
num_mods--; num_mods--;
@ -905,9 +905,9 @@ increase_modlist(void)
if((num_mods + 1) < max_mods) if((num_mods + 1) < max_mods)
return; return;
new_modlist = (struct module **) rb_malloc(sizeof(struct module) * new_modlist = (struct module **) rb_malloc(sizeof(struct module *) *
(max_mods + MODS_INCREMENT)); (max_mods + MODS_INCREMENT));
memcpy((void *) new_modlist, (void *) modlist, sizeof(struct module) * num_mods); memcpy((void *) new_modlist, (void *) modlist, sizeof(struct module *) * num_mods);
rb_free(modlist); rb_free(modlist);
modlist = new_modlist; modlist = new_modlist;