From bfd47a0b33ff38bda39b11d64cf31e32bbfd19d2 Mon Sep 17 00:00:00 2001 From: Stefan Pöschel Date: Wed, 23 Aug 2017 16:37:40 +0200 Subject: SLS: fix open slide file in error case --- src/sls.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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; } -- cgit v1.2.3