From 2f2342329d0713258af46e681a0c9671f08c07e2 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 13 Oct 2014 19:19:31 +0200 Subject: [PATCH] No need to check for nullptr on free Signed-off-by: Sven Strickroth Signed-off-by: Sup Yut Sum --- src/Git/GitIndex.cpp | 7 ++----- src/Git/gitindex.h | 3 +-- src/TortoiseProc/GitLogCache.cpp | 3 +-- src/TortoiseProc/StatGraphDlg.cpp | 3 +-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Git/GitIndex.cpp b/src/Git/GitIndex.cpp index 5975e0149..afadc08af 100644 --- a/src/Git/GitIndex.cpp +++ b/src/Git/GitIndex.cpp @@ -778,11 +778,8 @@ int CGitIgnoreItem::FetchIgnoreList(const CString &projectroot, const CString &f git_free_exclude_list(m_pExcludeList); m_pExcludeList=NULL; } - if (m_buffer) - { - free(m_buffer); - m_buffer = NULL; - } + free(m_buffer); + m_buffer = nullptr; this->m_BaseDir.Empty(); if (!isGlobal) diff --git a/src/Git/gitindex.h b/src/Git/gitindex.h index 429bf3c17..aa4acec5e 100644 --- a/src/Git/gitindex.h +++ b/src/Git/gitindex.h @@ -244,8 +244,7 @@ public: { if(m_pExcludeList) git_free_exclude_list(m_pExcludeList); - if (m_buffer) - free(m_buffer); + free(m_buffer); m_pExcludeList=NULL; m_buffer = NULL; } diff --git a/src/TortoiseProc/GitLogCache.cpp b/src/TortoiseProc/GitLogCache.cpp index 51b47ad99..2dbf05f98 100644 --- a/src/TortoiseProc/GitLogCache.cpp +++ b/src/TortoiseProc/GitLogCache.cpp @@ -523,8 +523,7 @@ int CLogCache::SaveCache() this->CloseDataHandles(); this->CloseIndexHandles(); - if(pIndex) - free(pIndex); + free(pIndex); return ret; } diff --git a/src/TortoiseProc/StatGraphDlg.cpp b/src/TortoiseProc/StatGraphDlg.cpp index 5064cb55c..c3fd06c42 100644 --- a/src/TortoiseProc/StatGraphDlg.cpp +++ b/src/TortoiseProc/StatGraphDlg.cpp @@ -774,8 +774,7 @@ int CStatGraphDlg::GatherData(BOOL fetchdiff, BOOL keepFetchedData) payload_struct payload = { pLogEntry, nullptr }; const char *author1 = git_get_mailmap_author(mailmap, email2A, &payload, [] (void *payload) -> const char * { return ((payload_struct *)payload)->authorName = _strdup(CUnicodeUtils::GetUTF8(((payload_struct *)payload)->rev->GetAuthorName())); }); - if (payload.authorName) - free((void *)payload.authorName); + free((void *)payload.authorName); if (author1) strAuthor = CUnicodeUtils::GetUnicode(author1); } -- 2.11.4.GIT