X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fcommand_db.c;h=d5af5c27f8bdf8f6944f384f790e931168bc3d45;hb=2f0b15e05b0df7e10a2d0bb04ce4648455d980a8;hp=0d4cb944d56cc94cba117ae6d06a1965525d6429;hpb=b97faa0009abc699ab7bff7bcc3221b8b3104e12;p=plomrogue diff --git a/src/command_db.c b/src/command_db.c index 0d4cb94..d5af5c2 100644 --- a/src/command_db.c +++ b/src/command_db.c @@ -88,8 +88,7 @@ extern void init_command_db(struct World * world) uint16_t lines, linemax; exit_err(textfile_sizes(file, &linemax, &lines), world, err_s); - char * line = malloc(linemax); - exit_err(NULL == line, world, err_m); + char line[linemax]; struct Command * cmds = malloc(lines * sizeof(struct Command)); exit_err(NULL == line, world, err_m); uint8_t i = 0; @@ -100,7 +99,6 @@ extern void init_command_db(struct World * world) copy_tokenized_string(world, &cmds[i].dsc_long, "\n", err_m); i++; } - free(line); exit_err(fclose(file), world, err_c); world->cmd_db = malloc(sizeof(struct CommandDB));