mirror of
https://github.com/Tha14/toxic.git
synced 2025-04-20 05:22:58 +02:00
fix possible memory leak
This commit is contained in:
parent
246a514e88
commit
a9bcab4aee
@ -58,6 +58,7 @@ void init_logging_session(uint8_t *name, uint8_t *key, struct chatlog *log)
|
|||||||
|
|
||||||
if (path_len > MAX_STR_SIZE) {
|
if (path_len > MAX_STR_SIZE) {
|
||||||
log->log_on = false;
|
log->log_on = false;
|
||||||
|
free(user_config_dir);
|
||||||
return;
|
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",
|
snprintf(log_path, MAX_STR_SIZE, "%s%s%s-%s.log",
|
||||||
user_config_dir, CONFIGDIR, name, ident);
|
user_config_dir, CONFIGDIR, name, ident);
|
||||||
|
|
||||||
|
free(user_config_dir);
|
||||||
|
|
||||||
log->file = fopen(log_path, "a");
|
log->file = fopen(log_path, "a");
|
||||||
|
|
||||||
if (log->file == NULL) {
|
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");
|
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)
|
void write_to_log(const uint8_t *msg, uint8_t *name, struct chatlog *log, bool event)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user