Fix minor valgrind issues

- Fix valgrind invalid write of 1 byte.
- Fix a few plugin related memory leaks.
This commit is contained in:
Jan Vidar Krey
2011-12-01 13:37:07 +01:00
parent c17b43e77f
commit 9f16298688
4 changed files with 15 additions and 1 deletions

View File

@@ -30,7 +30,7 @@ struct cfg_tokens
struct cfg_tokens* cfg_tokenize(const char* line)
{
struct cfg_tokens* tokens = (struct cfg_tokens*) hub_malloc_zero(sizeof(struct cfg_tokens));
char* buffer = (char*) hub_malloc_zero(strlen(line));
char* buffer = (char*) hub_malloc_zero(strlen(line) + 1);
char* out = buffer;
const char* p = line;
int backslash = 0;
@@ -68,6 +68,7 @@ struct cfg_tokens* cfg_tokenize(const char* line)
else
{
RESET_TOKEN;
hub_free(buffer);
return tokens;
}
break;
@@ -115,6 +116,7 @@ struct cfg_tokens* cfg_tokenize(const char* line)
}
RESET_TOKEN;
hub_free(buffer);
return tokens;
}