diff --git a/src/logging.c b/src/logging.c index d6de280..3970b56 100644 --- a/src/logging.c +++ b/src/logging.c @@ -192,9 +192,11 @@ struct uc_log_destination *uc_log_new_file(const char *filename, int log_level, f = fopen(filename, "a"); if (f == NULL) { + int saved_errno = errno; free(dest->module_settings); free(name); free(dest); + errno = saved_errno; return NULL; }