aboutsummaryrefslogtreecommitdiffstats
path: root/src/sls.cpp
diff options
context:
space:
mode:
authorStefan Pöschel <github@basicmaster.de>2017-08-23 16:37:40 +0200
committerStefan Pöschel <github@basicmaster.de>2017-08-23 16:37:40 +0200
commitbfd47a0b33ff38bda39b11d64cf31e32bbfd19d2 (patch)
treef7c323bfa356e81ef055d072ba62fa6b3fff10e2 /src/sls.cpp
parent6558ca077ef430bd4ce595a4917a5706565f0aad (diff)
downloadODR-PadEnc-bfd47a0b33ff38bda39b11d64cf31e32bbfd19d2.tar.gz
ODR-PadEnc-bfd47a0b33ff38bda39b11d64cf31e32bbfd19d2.tar.bz2
ODR-PadEnc-bfd47a0b33ff38bda39b11d64cf31e32bbfd19d2.zip
SLS: fix open slide file in error case
Diffstat (limited to 'src/sls.cpp')
-rw-r--r--src/sls.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/sls.cpp b/src/sls.cpp
index 0eead68..aa0167f 100644
--- a/src/sls.cpp
+++ b/src/sls.cpp
@@ -486,12 +486,14 @@ bool SLSManager::encodeFile(const std::string& fname, int fidx, bool raw_slides)
blob = (uint8_t*) malloc(blobsize);
if (blob == NULL) {
fprintf(stderr, "ODR-PadEnc Error: Memory allocation error\n");
+ fclose(pFile);
goto encodefile_out;
}
// copy the file into the buffer:
if (fread(blob, blobsize, 1, pFile) != 1) {
fprintf(stderr, "ODR-PadEnc Error: Could not read file\n");
+ fclose(pFile);
goto encodefile_out;
}