Merge pull request #29 from francois-berder/master

Various improvements -- thank you!
This commit is contained in:
Emmanuel Marty
2019-08-28 13:50:00 +02:00
committed by GitHub
2 changed files with 7 additions and 3 deletions

View File

@@ -96,6 +96,6 @@ int lzsa_dictionary_load(const char *pszDictionaryFilename, void **ppDictionaryD
void lzsa_dictionary_free(void **ppDictionaryData) { void lzsa_dictionary_free(void **ppDictionaryData) {
if (*ppDictionaryData) { if (*ppDictionaryData) {
free(*ppDictionaryData); free(*ppDictionaryData);
ppDictionaryData = NULL; *ppDictionaryData = NULL;
} }
} }

View File

@@ -277,8 +277,10 @@ int comparestream_open(lzsa_stream_t *stream, const char *pszCompareFilename, co
stream->close = comparestream_close; stream->close = comparestream_close;
return 0; return 0;
} }
else else {
free(pCompareStream);
return -1; return -1;
}
} }
static int do_compare(const char *pszInFilename, const char *pszOutFilename, const char *pszDictionaryFilename, const unsigned int nOptions, int nFormatVersion) { static int do_compare(const char *pszInFilename, const char *pszOutFilename, const char *pszDictionaryFilename, const unsigned int nOptions, int nFormatVersion) {
@@ -1052,7 +1054,9 @@ int main(int argc, char **argv) {
if (cCommand == 'z') { if (cCommand == 'z') {
int nResult = do_compress(pszInFilename, pszOutFilename, pszDictionaryFilename, nOptions, nMinMatchSize, nFormatVersion); int nResult = do_compress(pszInFilename, pszOutFilename, pszDictionaryFilename, nOptions, nMinMatchSize, nFormatVersion);
if (nResult == 0 && bVerifyCompression) { if (nResult == 0 && bVerifyCompression) {
nResult = do_compare(pszOutFilename, pszInFilename, pszDictionaryFilename, nOptions, nFormatVersion); return do_compare(pszOutFilename, pszInFilename, pszDictionaryFilename, nOptions, nFormatVersion);
} else {
return nResult;
} }
} }
else if (cCommand == 'd') { else if (cCommand == 'd') {