aboutsummaryrefslogtreecommitdiff
path: root/src/SFileAddFile.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <ladislav.zezula@avg.com>2014-12-02 09:38:34 +0100
committerLadislav Zezula <ladislav.zezula@avg.com>2014-12-02 09:38:34 +0100
commit3e594190e4a89252755907a313914a96b6abb1c8 (patch)
treedcfd8cb1b143d8728a627b92f0fa71472f3b88ef /src/SFileAddFile.cpp
parent495b2ab3d42db3f0d484e76eba15c7da9148d53a (diff)
+ Files with zero size are now processed properly during archive compacting
+ Fixed few memory leaks
Diffstat (limited to 'src/SFileAddFile.cpp')
-rw-r--r--src/SFileAddFile.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/SFileAddFile.cpp b/src/SFileAddFile.cpp
index f941141..5997c1b 100644
--- a/src/SFileAddFile.cpp
+++ b/src/SFileAddFile.cpp
@@ -479,11 +479,14 @@ int SFileAddFile_Init(
// Call the callback, if needed
if(ha->pfnAddFileCB != NULL)
ha->pfnAddFileCB(ha->pvAddFileUserData, 0, hf->dwDataSize, false);
+ hf->nAddFileError = ERROR_SUCCESS;
}
- // Store the error code from Add File operation
- if(hf != NULL)
- hf->nAddFileError = nError;
+ // Fre the file handle if failed
+ if(nError != ERROR_SUCCESS && hf != NULL)
+ FreeFileHandle(hf);
+
+ // Give the handle to the caller
*phf = hf;
return nError;
}