Skip to content

Commit

Permalink
prevent dangling pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
Zabrimus committed Oct 15, 2016
1 parent 41ef30b commit d3a2b56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions recordings.cpp
Expand Up @@ -853,11 +853,11 @@ FILE* SyncMap::getSyncFile(bool write = false) {

string cacheDir = (string)Settings::get()->CacheDirectory() + "/sync";
FileExtension::get()->exists(cacheDir) || system(("mkdir -p " + cacheDir).c_str());
const char* fileName = (cacheDir + "/" + this->id).c_str();
FILE* fp = fopen(fileName, write ? "w" : "r");
std::string fileName = (cacheDir + "/" + this->id);
FILE* fp = fopen(fileName.c_str(), write ? "w" : "r");

if ( fp == NULL ) {
esyslog("restfulapi: could not open sync map file %s for %s!", fileName, write ? "writing" : "reading");
esyslog("restfulapi: could not open sync map file %s for %s!", fileName.c_str(), write ? "writing" : "reading");
}

return fp;
Expand Down

0 comments on commit d3a2b56

Please sign in to comment.