Check the return value for null or check the pointer for null before
From: Erik Hovland <erik@hovland.org>
dereferencing.
---
libs/libmythtv/NuppelVideoRecorder.cpp | 7 +++++++
libs/libmythtv/avformatdecoder.cpp | 19 +++++++++++--------
libs/libmythtv/fifowriter.cpp | 3 ++-
libs/libmythtv/osdimagecache.cpp | 8 +++++++-
libs/libmythtv/viewschdiff.cpp | 5 +++++
libs/libmythtv/xine_demux_sputext.c | 2 ++
6 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/libs/libmythtv/NuppelVideoRecorder.cpp b/libs/libmythtv/NuppelVideoRecorder.cpp
index d24e38a..b599847 100644
|
a
|
b
|
void NuppelVideoRecorder::WriteVideo(VideoFrame *frame, bool skipsync,
|
| 3081 | 3081 | QMutexLocker locker(&avcodeclock); |
| 3082 | 3082 | tmp = avcodec_encode_video(mpa_vidctx, (unsigned char *)strm, |
| 3083 | 3083 | len, &mpa_picture); |
| | 3084 | if (tmp == -1) |
| | 3085 | { |
| | 3086 | VERBOSE(VB_IMPORTANT, |
| | 3087 | LOC_ERR + "NuppelVideoRecorder::WriteVideo : " |
| | 3088 | "avcodec_encode_video() failed"); |
| | 3089 | return; |
| | 3090 | } |
| 3084 | 3091 | } |
| 3085 | 3092 | } |
| 3086 | 3093 | else |
diff --git a/libs/libmythtv/avformatdecoder.cpp b/libs/libmythtv/avformatdecoder.cpp
index 1315686..e7b4735 100644
|
a
|
b
|
void AvFormatDecoder::ScanTeletextCaptions(int av_index)
|
| 1373 | 1373 | */ |
| 1374 | 1374 | void AvFormatDecoder::ScanDSMCCStreams(void) |
| 1375 | 1375 | { |
| 1376 | | if (!ic->cur_pmt_sect) |
| | 1376 | if (!ic || !ic->cur_pmt_sect) |
| 1377 | 1377 | return; |
| 1378 | 1378 | |
| 1379 | 1379 | if (!itv && ! (itv = GetNVP()->GetInteractiveTV())) |
| … |
… |
bool AvFormatDecoder::GetFrame(int onlyvideo)
|
| 3541 | 3541 | if (!allowedquit && (onlyvideo < 0)) |
| 3542 | 3542 | { |
| 3543 | 3543 | uint fill, total; |
| 3544 | | GetNVP()->GetAudioBufferStatus(fill, total); |
| 3545 | | total /= 6; // HACK needed for some audio files |
| 3546 | | allowedquit = |
| 3547 | | (fill == 0) || (fill > (total>>1)) || |
| 3548 | | ((total - fill) < (uint) data_size) || |
| 3549 | | (ofill + total_decoded_audio > (total>>2)) || |
| 3550 | | ((total - fill) < (uint) data_size * 2); |
| | 3544 | if (GetNVP()->GetAudioBufferStatus(fill, total)) { |
| | 3545 | total /= 6; // HACK needed for some audio files |
| | 3546 | allowedquit = |
| | 3547 | (fill == 0) || (fill > (total>>1)) || |
| | 3548 | ((total - fill) < (uint) data_size) || |
| | 3549 | (ofill + total_decoded_audio > (total>>2)) || |
| | 3550 | ((total - fill) < (uint) data_size * 2); |
| | 3551 | } else |
| | 3552 | VERBOSE(VB_IMPORTANT, LOC_ERR + "AvFormatDecoder::GetFrame : " |
| | 3553 | "Failed topping off buffers in audio only mode"); |
| 3551 | 3554 | } |
| 3552 | 3555 | |
| 3553 | 3556 | break; |
diff --git a/libs/libmythtv/fifowriter.cpp b/libs/libmythtv/fifowriter.cpp
index 15addc2..38d0d42 100644
|
a
|
b
|
void FIFOWriter::FIFOWriteThread(void)
|
| 142 | 142 | break; |
| 143 | 143 | if (fd == -1) |
| 144 | 144 | fd = open(filename[id].ascii(), O_WRONLY| O_SYNC); |
| 145 | | write(fd, fb_outptr[id]->data, fb_outptr[id]->blksize); |
| | 145 | if (fd >= 0) |
| | 146 | write(fd, fb_outptr[id]->data, fb_outptr[id]->blksize); |
| 146 | 147 | pthread_mutex_lock(&fifo_lock[id]); |
| 147 | 148 | fb_outptr[id] = fb_outptr[id]->next; |
| 148 | 149 | pthread_cond_signal(&full_cond[id]); |
diff --git a/libs/libmythtv/osdimagecache.cpp b/libs/libmythtv/osdimagecache.cpp
index a3f986a..d5be817 100644
|
a
|
b
|
OSDImageCacheValue *OSDImageCache::Get(const QString &key, bool useFile)
|
| 172 | 172 | |
| 173 | 173 | QDir dir(MythContext::GetConfDir() + "/osdcache/"); |
| 174 | 174 | QFile cacheFile(dir.path() + "/" + key); |
| 175 | | cacheFile.open(QIODevice::ReadOnly); |
| | 175 | if (!cacheFile.open(QIODevice::IO_ReadOnly)) |
| | 176 | { |
| | 177 | VERBOSE(VB_IMPORTANT, |
| | 178 | LOC_ERR + key + " Failed opening read-only cache file"); |
| | 179 | return NULL; |
| | 180 | } |
| | 181 | |
| 176 | 182 | uint32_t imwidth = 0; |
| 177 | 183 | uint32_t imheight = 0; |
| 178 | 184 | |
diff --git a/libs/libmythtv/viewschdiff.cpp b/libs/libmythtv/viewschdiff.cpp
index e618e66..c321299 100644
|
a
|
b
|
void ViewScheduleDiff::updateBackground(void)
|
| 201 | 201 | QPainter tmp(&bground); |
| 202 | 202 | |
| 203 | 203 | LayerSet *container = theme->GetSet("background"); |
| | 204 | if (!container) |
| | 205 | return; |
| | 206 | |
| 204 | 207 | container->Draw(&tmp, 0, 0); |
| 205 | 208 | |
| 206 | 209 | tmp.end(); |
| … |
… |
void ViewScheduleDiff::edit()
|
| 263 | 266 | void ViewScheduleDiff::upcoming() |
| 264 | 267 | { |
| 265 | 268 | ProgramInfo *pi = CurrentProgram(); |
| | 269 | if (!pi) |
| | 270 | return; |
| 266 | 271 | |
| 267 | 272 | ProgLister *pl = new ProgLister(plTitle, pi->title, "", |
| 268 | 273 | gContext->GetMainWindow(), "proglist"); |
diff --git a/libs/libmythtv/xine_demux_sputext.c b/libs/libmythtv/xine_demux_sputext.c
index b4bdb23..5ca78fc 100644
|
a
|
b
|
static subtitle_t *sub_read_line_ssa(demux_sputext_t *this,subtitle_t *current)
|
| 523 | 523 | line3) < 9 ); |
| 524 | 524 | |
| 525 | 525 | line2=strchr(line3, ','); |
| | 526 | if (!line2) |
| | 527 | return NULL; |
| 526 | 528 | |
| 527 | 529 | for (comma = 4; comma < max_comma; comma ++) |
| 528 | 530 | { |