diff options
| author | Mark Stapp <mjs@voltanet.io> | 2020-09-08 15:25:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-08 15:25:08 -0400 |
| commit | 000ce30ee5c475169c43a1c927582f9ccbc24a7d (patch) | |
| tree | 4c2894983d8d9496dd10b03f1750e0d4786a34a4 | |
| parent | 28a54742caf6fc186d8d088cf2d6c6e76da01473 (diff) | |
| parent | 589b5e4802920d260ce1804d51ce0b1e80788622 (diff) | |
Merge pull request #7047 from qlyoung/fix-zlog-target-null-derefbase_7.5
lib: fix possible null dereference in zlog
| -rw-r--r-- | lib/zlog_targets.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/zlog_targets.c b/lib/zlog_targets.c index b23ab073b4..8f4c2a46a8 100644 --- a/lib/zlog_targets.c +++ b/lib/zlog_targets.c @@ -225,10 +225,11 @@ static bool zlog_file_cycle(struct zlog_cfg_file *zcf) zlt->zt.logfn_sigsafe = zlog_fd_sigsafe; } while (0); - old = zlog_target_replace(&zcf->active->zt, &zlt->zt); + old = zlog_target_replace(zcf->active ? &zcf->active->zt : NULL, + zlt ? &zlt->zt : NULL); zcf->active = zlt; - zlog_file_target_free(container_of(old, struct zlt_fd, zt)); + zlog_file_target_free(container_of_null(old, struct zlt_fd, zt)); return rv; } |
