Kaynağa Gözat

Fix FD leak in POSIX Env.

Deleting a PosixWritableFile without calling Close() leaks the file
descriptor. While the API description in include/leveldb/env.h does not
specify whether the caller is responsible for Close()ing the file before
deleting it, all other Env file implementations do release underlying
resources when destroyed, even if Close() is not called.

The leak shows up when running db_tests on Mac Travis, or on a vanilla
MacOS install.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170906843
xry
costan 7 yıl önce
işlemeyi yapan: Victor Costan
ebeveyn
işleme
8ae7998aab
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. +1
    -1
      util/env_posix.cc

+ 1
- 1
util/env_posix.cc Dosyayı Görüntüle

@ -230,7 +230,7 @@ class PosixWritableFile : public WritableFile {
~PosixWritableFile() { ~PosixWritableFile() {
if (fd_ >= 0) { if (fd_ >= 0) {
// Ignoring any potential errors // Ignoring any potential errors
FlushBuffered();
Close();
} }
} }

Yükleniyor…
İptal
Kaydet