Skip to content

Commit

Permalink
fix missing element size in array relocaiton in main
Browse files Browse the repository at this point in the history
  • Loading branch information
blu committed Sep 18, 2021
1 parent 3b70fba commit c8900f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ int main(int argc, char **argv)
return -1;
}
if (areas.count == areas_capacity) {
areas.arr = (char **)realloc(areas.arr, areas_capacity = (areas_capacity + 1) * 2);
areas.arr = (char **)realloc(areas.arr, sizeof(*areas.arr) * (areas_capacity = (areas_capacity + 1) * 2));
}
areas.arr[areas.count++] = argv[i];
continue;
Expand All @@ -660,7 +660,7 @@ int main(int argc, char **argv)
#endif
/* Unprefixed arg must be a file */
if (objs.count == objs_capacity) {
objs.arr = (char **)realloc(objs.arr, objs_capacity = (objs_capacity + 1) * 2);
objs.arr = (char **)realloc(objs.arr, sizeof(*objs.arr) * (objs_capacity = (objs_capacity + 1) * 2));
}

objs.arr[objs.count++] = argv[i];
Expand Down

0 comments on commit c8900f2

Please sign in to comment.