Swap calloc arguments to use them properly.

This commit is contained in:
Rose
2023-10-15 10:47:05 -04:00
committed by Todd C. Miller
parent dd8426f9cf
commit a4cbd7fe7b
3 changed files with 4 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ main(int argc, char *argv[])
/* Build up test data. */
ntests = 256 + 256 + 3;
test_data = calloc(sizeof(*test_data), (size_t)ntests);
test_data = calloc((size_t)ntests, sizeof(*test_data));
for (i = 0; i < 256; i++) {
/* lower case */
test_data[i].value = i;

View File

@@ -69,7 +69,8 @@ int
main(int argc, char *argv[])
{
GETGROUPS_T *gidlist = NULL;
int i, j, errors = 0, ntests = 0;
size_t i;
int j, errors = 0, ntests = 0;
int ch, ngids;
initprogname(argc > 0 ? argv[0] : "parse_gids_test");

View File

@@ -360,7 +360,7 @@ parse_plugin(const char *entry, const char *conf_file, unsigned int lineno)
options[nopts] = NULL;
}
info = calloc(sizeof(*info), 1);
info = calloc(1, sizeof(*info));
if (info == NULL)
goto oom;
info->symbol_name = strndup(symbol, symlen);