allocate string buffer when appending new config option at runtime

This commit is contained in:
Sebastian Krzyszkowiak 2012-02-27 22:50:05 +01:00
parent 6b877d10a2
commit 654472f79a

View file

@ -37,6 +37,9 @@ struct ConfigOption *config;
void AppendToConfig(char* section, char* name, char* value) { void AppendToConfig(char* section, char* name, char* value) {
struct ConfigOption *new = malloc(sizeof(struct ConfigOption)); struct ConfigOption *new = malloc(sizeof(struct ConfigOption));
new->next = NULL; new->next = NULL;
new->section = malloc(sizeof(char)*255);
new->name = malloc(sizeof(char)*255);
new->value = malloc(sizeof(char)*255);
strcpy(new->section, section); strcpy(new->section, section);
strcpy(new->name, name); strcpy(new->name, name);
strcpy(new->value, value); strcpy(new->value, value);