mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 23:15:07 -05:00
Fix possible leaks of temporary file names
This commit is contained in:
@@ -313,6 +313,7 @@ update_drift_file(double freq_ppm, double skew)
|
|||||||
/* Write the frequency and skew parameters in ppm */
|
/* Write the frequency and skew parameters in ppm */
|
||||||
if ((fprintf(out, "%20.6f %20.6f\n", freq_ppm, 1.0e6 * skew) < 0) |
|
if ((fprintf(out, "%20.6f %20.6f\n", freq_ppm, 1.0e6 * skew) < 0) |
|
||||||
fclose(out)) {
|
fclose(out)) {
|
||||||
|
Free(temp_drift_file);
|
||||||
LOG(LOGS_WARN, LOGF_Reference, "Could not write to temporary driftfile %s.tmp",
|
LOG(LOGS_WARN, LOGF_Reference, "Could not write to temporary driftfile %s.tmp",
|
||||||
drift_file);
|
drift_file);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -453,6 +453,7 @@ write_coefs_to_file(int valid,time_t ref_time,double offset,double rate)
|
|||||||
if ((fprintf(out, "%1d %ld %.6f %.3f\n",
|
if ((fprintf(out, "%1d %ld %.6f %.3f\n",
|
||||||
valid,ref_time, offset, 1.0e6 * rate) < 0) |
|
valid,ref_time, offset, 1.0e6 * rate) < 0) |
|
||||||
fclose(out)) {
|
fclose(out)) {
|
||||||
|
Free(temp_coefs_file_name);
|
||||||
LOG(LOGS_WARN, LOGF_RtcLinux, "Could not write to temporary RTC file %s.tmp",
|
LOG(LOGS_WARN, LOGF_RtcLinux, "Could not write to temporary RTC file %s.tmp",
|
||||||
coefs_file_name);
|
coefs_file_name);
|
||||||
return RTC_ST_BADFILE;
|
return RTC_ST_BADFILE;
|
||||||
|
|||||||
Reference in New Issue
Block a user