Mercurial > hg > dhcpcd
comparison src/logerr.c @ 5579:22d473eabfcc draft
Linux: fix a memory leak when dhcpcd exits or the log is reopened
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Sun, 24 Jan 2021 22:53:20 +0000 |
| parents | 071a9ea18363 |
| children |
comparison
equal
deleted
inserted
replaced
| 5578:57e4bf2cc9e7 | 5579:22d473eabfcc |
|---|---|
| 482 #ifndef SMALL | 482 #ifndef SMALL |
| 483 struct logctx *ctx = &_logctx; | 483 struct logctx *ctx = &_logctx; |
| 484 #endif | 484 #endif |
| 485 | 485 |
| 486 closelog(); | 486 closelog(); |
| 487 #if defined(__linux__) | |
| 488 free(_logprog); | |
| 489 _logprog = NULL; | |
| 490 #endif | |
| 487 #ifndef SMALL | 491 #ifndef SMALL |
| 488 if (ctx->log_file == NULL) | 492 if (ctx->log_file == NULL) |
| 489 return; | 493 return; |
| 490 fclose(ctx->log_file); | 494 fclose(ctx->log_file); |
| 491 ctx->log_file = NULL; | 495 ctx->log_file = NULL; |
| 492 #endif | 496 #endif |
| 493 #if defined(__linux__) | 497 } |
| 494 free(_logprog); | |
| 495 #endif | |
| 496 } |
