wmgeneral: Don't call free on pointers we haven't malloced.

Could cause occasional segfaults.
This commit is contained in:
Doug Torrance 2015-05-19 22:30:55 -05:00 committed by Carlos R. Mafra
parent a9b73f2fd6
commit 624b2898fe
12 changed files with 0 additions and 48 deletions

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }

View file

@ -141,12 +141,10 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = '\0'; if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
} }
free(q);
} }
fclose(fp); fclose(fp);
} }
@ -178,7 +176,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0; if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p); *keys[key].var = strdup(p);
key = -1; key = -1;
} else key++; } else key++;
@ -186,7 +183,6 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
fclose(fp); fclose(fp);
} }
free(family);
} }