1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-26 20:57:48 +02:00

fix possible memory leak

This commit is contained in:
Jfreegman 2014-04-06 05:20:46 -04:00
parent 246a514e88
commit a9bcab4aee
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -58,6 +58,7 @@ void init_logging_session(uint8_t *name, uint8_t *key, struct chatlog *log)
if (path_len > MAX_STR_SIZE) {
log->log_on = false;
free(user_config_dir);
return;
}
@ -66,6 +67,8 @@ void init_logging_session(uint8_t *name, uint8_t *key, struct chatlog *log)
snprintf(log_path, MAX_STR_SIZE, "%s%s%s-%s.log",
user_config_dir, CONFIGDIR, name, ident);
free(user_config_dir);
log->file = fopen(log_path, "a");
if (log->file == NULL) {
@ -74,7 +77,6 @@ void init_logging_session(uint8_t *name, uint8_t *key, struct chatlog *log)
}
fprintf(log->file, "\n*** NEW SESSION ***\n\n");
free(user_config_dir);
}
void write_to_log(const uint8_t *msg, uint8_t *name, struct chatlog *log, bool event)