mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
fix(log): fix SLogDestroy() memory corruption
This commit is contained in:
parent
b195319ff6
commit
96c121717b
1 changed files with 6 additions and 1 deletions
|
|
@ -414,12 +414,17 @@ int SLogIsInitialized() {
|
||||||
void SLogDestroy() {
|
void SLogDestroy() {
|
||||||
for (size_t i = 0; i < STORM_LOG_MAX_CHANNELS; ++i) {
|
for (size_t i = 0; i < STORM_LOG_MAX_CHANNELS; ++i) {
|
||||||
s_critsect[i]->Enter();
|
s_critsect[i]->Enter();
|
||||||
for (LOG* log = s_loghead[i]; log; log = log->next) {
|
LOG* log = s_loghead[i];
|
||||||
|
while (log) {
|
||||||
if (log->file) {
|
if (log->file) {
|
||||||
FlushLog(log);
|
FlushLog(log);
|
||||||
fclose(log->file);
|
fclose(log->file);
|
||||||
}
|
}
|
||||||
|
LOG* next = log->next;
|
||||||
|
SMemFree(log);
|
||||||
|
log = next;
|
||||||
}
|
}
|
||||||
|
s_loghead[i] = nullptr;
|
||||||
s_critsect[i]->Leave();
|
s_critsect[i]->Leave();
|
||||||
delete s_critsect[i];
|
delete s_critsect[i];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue