mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 23:25:32 -04:00
added a new method rs_malloc that checks its arguments and prints a stacktrace on error/weird call. Changed the code everywhere to use this instead of malloc. Removed some mallocs and replaced with RsTemporaryMemory
This commit is contained in:
parent
9c6e7dfc13
commit
d13526facd
39 changed files with 274 additions and 132 deletions
|
@ -10,6 +10,8 @@
|
|||
#include <QBuffer>
|
||||
#include <QImage>
|
||||
|
||||
#include "util/rsmemory.h"
|
||||
|
||||
#include "VideoProcessor.h"
|
||||
#include "QVideoDevice.h"
|
||||
|
||||
|
@ -384,7 +386,10 @@ bool JPEGVideo::encodeData(const QImage& image,uint32_t /* size_hint */,RsVOIPDa
|
|||
buffer.open(QIODevice::WriteOnly) ;
|
||||
encoded_frame.save(&buffer,"JPEG") ;
|
||||
|
||||
voip_chunk.data = malloc(HEADER_SIZE + qb.size());
|
||||
voip_chunk.data = rs_safe_malloc(HEADER_SIZE + qb.size());
|
||||
|
||||
if(!voip_chunk.data)
|
||||
return false ;
|
||||
|
||||
// build header
|
||||
uint32_t flags = differential_frame ? JPEG_VIDEO_FLAGS_DIFFERENTIAL_FRAME : 0x0 ;
|
||||
|
@ -679,7 +684,11 @@ bool FFmpegVideo::encodeData(const QImage& image, uint32_t target_encoding_bitra
|
|||
|
||||
if(got_output)
|
||||
{
|
||||
voip_chunk.data = malloc(pkt.size + HEADER_SIZE) ;
|
||||
voip_chunk.data = rs_safe_malloc(pkt.size + HEADER_SIZE) ;
|
||||
|
||||
if(!voip_chunk.data)
|
||||
return false ;
|
||||
|
||||
uint32_t flags = 0;
|
||||
|
||||
((unsigned char *)voip_chunk.data)[0] = VideoProcessor::VIDEO_PROCESSOR_CODEC_ID_MPEG_VIDEO & 0xff ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue