Browse files

Merge pull request #4431 from cg110/CoverityFixes1

Fix some coverity scan issues
  • Loading branch information...
2 parents 56ebbc6 + cb1143f commit f29be5c4cb2791841ecb069b2ef1a1c93d5e8291 @jmarshallnz jmarshallnz committed Apr 30, 2014
View
2 xbmc/cores/dvdplayer/DVDAudio.cpp
@@ -106,7 +106,7 @@ static void* realloc_or_free(void* src, int len) throw(exception)
{
CLog::Log(LOGERROR, "DVDAUDIO - %s : could not realloc the buffer", __FUNCTION__);
free(src);
- throw new exception();
+ throw exception();
}
}
View
6 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
@@ -555,6 +555,9 @@ void CDVDVideoCodecFFmpeg::Reset()
bool CDVDVideoCodecFFmpeg::GetPictureCommon(DVDVideoPicture* pDvdVideoPicture)
{
+ if (!m_pFrame)
+ return false;
+
pDvdVideoPicture->iWidth = m_pFrame->width;
pDvdVideoPicture->iHeight = m_pFrame->height;
@@ -592,9 +595,6 @@ bool CDVDVideoCodecFFmpeg::GetPictureCommon(DVDVideoPicture* pDvdVideoPicture)
pDvdVideoPicture->pts = DVD_NOPTS_VALUE;
- if (!m_pFrame)
- return false;
-
AVDictionaryEntry * entry = av_dict_get(av_frame_get_metadata(m_pFrame), "stereo_mode", NULL, 0);
if(entry && entry->value)
{
View
19 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -687,7 +687,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
}
// we need to get duration slightly different for matroska embedded text subtitels
- if(m_bMatroska && stream->codec->codec_id == AV_CODEC_ID_TEXT && m_pkt.pkt.convergence_duration != 0)
+ if(m_bMatroska && stream->codec && stream->codec->codec_id == AV_CODEC_ID_TEXT && m_pkt.pkt.convergence_duration != 0)
m_pkt.pkt.duration = m_pkt.pkt.convergence_duration;
if(m_bAVI && stream->codec && stream->codec->codec_type == AVMEDIA_TYPE_VIDEO)
@@ -1133,16 +1133,19 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int iId)
std::string fileName = "special://temp/fonts/";
XFILE::CDirectory::Create(fileName);
AVDictionaryEntry *nameTag = av_dict_get(pStream->metadata, "filename", NULL, 0);
- if (!nameTag) {
+ if (!nameTag)
+ {
CLog::Log(LOGERROR, "%s: TTF attachment has no name", __FUNCTION__);
- break;
}
- fileName += nameTag->value;
- XFILE::CFile file;
- if(pStream->codec->extradata && file.OpenForWrite(fileName))
+ else
{
- file.Write(pStream->codec->extradata, pStream->codec->extradata_size);
- file.Close();
+ fileName += nameTag->value;
+ XFILE::CFile file;
+ if(pStream->codec->extradata && file.OpenForWrite(fileName))
+ {
+ file.Write(pStream->codec->extradata, pStream->codec->extradata_size);
+ file.Close();
+ }
}
}
stream = new CDemuxStream();
View
5 xbmc/filesystem/SmartPlaylistDirectory.cpp
@@ -85,10 +85,13 @@ namespace XFILE
for (std::vector<CStdString>::const_iterator virtualFolder = virtualFolders.begin(); virtualFolder != virtualFolders.end(); virtualFolder++)
{
CFileItemPtr pItem = CFileItemPtr(new CFileItem(*virtualFolder, true));
- if (CFileDirectoryFactory::Create(*virtualFolder, pItem.get()) != NULL)
+ IFileDirectory *dir = CFileDirectoryFactory::Create(*virtualFolder, pItem.get());
+
+ if (dir != NULL)
{
pItem->SetSpecialSort(SortSpecialOnTop);
items.Add(pItem);
+ delete dir;
}
}

0 comments on commit f29be5c

Please sign in to comment.