X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fconfig_parser.c;h=c238f1b9fa9a647690bbeef526aac557c05be617;hb=be6619ff11cb1d551c9ec09db007cab9d85f1655;hp=4e66c91109f3f8f37d0dfddbeacc2da6545cb23c;hpb=c207921949440b0d7045bdf1f85c309a25bebdf0;p=i3%2Fi3 diff --git a/src/config_parser.c b/src/config_parser.c index 4e66c911..c238f1b9 100644 --- a/src/config_parser.c +++ b/src/config_parser.c @@ -171,7 +171,7 @@ static long get_long(const char *identifier) { static void clear_stack(void) { for (int c = 0; c < 10; c++) { - if (stack[c].type == STACK_STR && stack[c].val.str != NULL) + if (stack[c].type == STACK_STR) free(stack[c].val.str); stack[c].identifier = NULL; stack[c].val.str = NULL; @@ -409,7 +409,7 @@ struct ConfigResultIR *parse_config(const char *input, struct context *context) if (*walk == '\0' || *walk == '\n' || *walk == '\r') { next_state(token); token_handled = true; -/* To make sure we start with an appropriate matching + /* To make sure we start with an appropriate matching * datastructure for commands which do *not* specify any * criteria, we re-initialize the criteria system after * every command. */ @@ -743,7 +743,7 @@ static char *migrate_config(char *input, off_t size) { /* read the script’s output */ int conv_size = 65535; - char *converted = smalloc(conv_size); + char *converted = scalloc(conv_size, 1); int read_bytes = 0, ret; do { if (read_bytes == conv_size) { @@ -1065,7 +1065,7 @@ bool parse_file(const char *f, bool use_nagbar) { int version = detect_version(buf); if (version == 3) { /* We need to convert this v3 configuration */ - char *converted = migrate_config(new, stbuf.st_size); + char *converted = migrate_config(new, strlen(new)); if (converted != NULL) { ELOG("\n"); ELOG("****************************************************************\n");