Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
继续操作前请注册或者登录。
Authored by
winlin
2014-05-13 14:24:39 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
befde6acf724ebcbeb70b2e62dc3fc311bbeebc7
befde6ac
1 parent
0a1c0afe
fix mem leak for delete[] SharedPtrMessage array, explicit free elems. remove srs_freepa. 0.9.95
隐藏空白字符变更
内嵌
并排对比
正在显示
15 个修改的文件
包含
209 行增加
和
174 行删除
trunk/src/app/srs_app_codec.cpp
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_conn.cpp
trunk/src/app/srs_app_edge.cpp
trunk/src/app/srs_app_ffmpeg.cpp
trunk/src/app/srs_app_forward.cpp
trunk/src/app/srs_app_http.cpp
trunk/src/app/srs_app_log.cpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_source.cpp
trunk/src/core/srs_core.hpp
trunk/src/libs/srs_librtmp.cpp
trunk/src/rtmp/srs_protocol_handshake.cpp
trunk/src/rtmp/srs_protocol_rtmp.cpp
trunk/src/rtmp/srs_protocol_rtmp_stack.cpp
trunk/src/app/srs_app_codec.cpp
查看文件 @
befde6a
...
...
@@ -50,7 +50,7 @@ void SrsCodecBuffer::append(void* data, int len)
void
SrsCodecBuffer
::
free
()
{
size
=
0
;
srs_freep
a
(
bytes
);
srs_freep
(
bytes
);
}
SrsCodecSample
::
SrsCodecSample
()
...
...
@@ -125,12 +125,12 @@ SrsCodec::SrsCodec()
SrsCodec
::~
SrsCodec
()
{
srs_freepa
(
avc_extra_data
);
srs_freepa
(
aac_extra_data
);
srs_freep
(
avc_extra_data
);
srs_freep
(
aac_extra_data
);
srs_freep
(
stream
);
srs_freepa
(
sequenceParameterSetNALUnit
);
srs_freepa
(
pictureParameterSetNALUnit
);
srs_freep
(
sequenceParameterSetNALUnit
);
srs_freep
(
pictureParameterSetNALUnit
);
}
int
SrsCodec
::
audio_aac_demux
(
int8_t
*
data
,
int
size
,
SrsCodecSample
*
sample
)
...
...
@@ -207,7 +207,7 @@ int SrsCodec::audio_aac_demux(int8_t* data, int size, SrsCodecSample* sample)
// 1.6.2.1 AudioSpecificConfig, in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 33.
aac_extra_size
=
stream
->
left
();
if
(
aac_extra_size
>
0
)
{
srs_freep
a
(
aac_extra_data
);
srs_freep
(
aac_extra_data
);
aac_extra_data
=
new
char
[
aac_extra_size
];
memcpy
(
aac_extra_data
,
stream
->
current
(),
aac_extra_size
);
}
...
...
@@ -321,7 +321,7 @@ int SrsCodec::video_avc_demux(int8_t* data, int size, SrsCodecSample* sample)
// 5.2.4.1.1 Syntax, H.264-AVC-ISO_IEC_14496-15.pdf, page 16
avc_extra_size
=
stream
->
left
();
if
(
avc_extra_size
>
0
)
{
srs_freep
a
(
avc_extra_data
);
srs_freep
(
avc_extra_data
);
avc_extra_data
=
new
char
[
avc_extra_size
];
memcpy
(
avc_extra_data
,
stream
->
current
(),
avc_extra_size
);
}
...
...
@@ -366,7 +366,7 @@ int SrsCodec::video_avc_demux(int8_t* data, int size, SrsCodecSample* sample)
return
ret
;
}
if
(
sequenceParameterSetLength
>
0
)
{
srs_freep
a
(
sequenceParameterSetNALUnit
);
srs_freep
(
sequenceParameterSetNALUnit
);
sequenceParameterSetNALUnit
=
new
char
[
sequenceParameterSetLength
];
memcpy
(
sequenceParameterSetNALUnit
,
stream
->
current
(),
sequenceParameterSetLength
);
stream
->
skip
(
sequenceParameterSetLength
);
...
...
@@ -396,7 +396,7 @@ int SrsCodec::video_avc_demux(int8_t* data, int size, SrsCodecSample* sample)
return
ret
;
}
if
(
pictureParameterSetLength
>
0
)
{
srs_freep
a
(
pictureParameterSetNALUnit
);
srs_freep
(
pictureParameterSetNALUnit
);
pictureParameterSetNALUnit
=
new
char
[
pictureParameterSetLength
];
memcpy
(
pictureParameterSetNALUnit
,
stream
->
current
(),
pictureParameterSetLength
);
stream
->
skip
(
pictureParameterSetLength
);
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
befde6a
...
...
@@ -93,7 +93,7 @@ SrsFileBuffer::SrsFileBuffer()
SrsFileBuffer
::~
SrsFileBuffer
()
{
srs_freep
a
(
start
);
srs_freep
(
start
);
}
int
SrsFileBuffer
::
fullfill
(
const
char
*
filename
)
...
...
@@ -117,7 +117,7 @@ int SrsFileBuffer::fullfill(const char* filename)
goto
finish
;
}
srs_freep
a
(
start
);
srs_freep
(
start
);
pos
=
last
=
start
=
new
char
[
filesize
];
end
=
start
+
filesize
;
...
...
@@ -407,15 +407,15 @@ int SrsConfDirective::read_token(SrsFileBuffer* buffer, vector<string>& args)
if
(
found
)
{
int
len
=
buffer
->
pos
-
pstart
;
char
*
word
=
new
char
[
len
];
memcpy
(
word
,
pstart
,
len
);
word
[
len
-
1
]
=
0
;
char
*
aword
=
new
char
[
len
];
memcpy
(
aword
,
pstart
,
len
);
aword
[
len
-
1
]
=
0
;
string
word_str
=
word
;
string
word_str
=
a
word
;
if
(
!
word_str
.
empty
())
{
args
.
push_back
(
word_str
);
}
srs_freep
a
(
word
);
srs_freep
(
a
word
);
if
(
ch
==
';'
)
{
return
ERROR_SYSTEM_CONFIG_DIRECTIVE
;
...
...
trunk/src/app/srs_app_conn.cpp
查看文件 @
befde6a
...
...
@@ -87,7 +87,7 @@ void SrsConnection::stop()
{
srs_close_stfd
(
stfd
);
srs_freep
(
pthread
);
srs_freep
a
(
ip
);
srs_freep
(
ip
);
}
int
SrsConnection
::
get_peer_ip
()
...
...
trunk/src/app/srs_app_edge.cpp
查看文件 @
befde6a
...
...
@@ -474,20 +474,33 @@ int SrsEdgeForwarder::cycle()
srs_verbose
(
"no packets to forward."
);
continue
;
}
SrsAutoFree
(
SrsSharedPtrMessage
*
,
msgs
,
true
);
// all msgs to forward.
// all msgs to forward to origin.
// @remark, becareful, all msgs must be free explicitly,
// free by send_and_free_message or srs_freep.
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
SrsSharedPtrMessage
*
msg
=
msgs
[
i
];
srs_assert
(
msg
);
msgs
[
i
]
=
NULL
;
// never use free msgs array, for it will memory leak.
// if error, directly free msgs.
if
(
ret
!=
ERROR_SUCCESS
)
{
srs_freep
(
msg
);
continue
;
}
if
((
ret
=
client
->
send_and_free_message
(
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"edge publish forwarder send message to server failed. ret=%d"
,
ret
);
return
ret
;
break
;
}
}
// free the array itself.
srs_freep
(
msgs
);
if
(
ret
!=
ERROR_SUCCESS
)
{
return
ret
;
}
}
return
ret
;
...
...
trunk/src/app/srs_app_ffmpeg.cpp
查看文件 @
befde6a
...
...
@@ -360,7 +360,7 @@ int SrsFFMPEG::start()
}
srs_trace
(
"start transcoder, log: %s, params: %s"
,
log_file
.
c_str
(),
pparam
);
srs_freep
a
(
pparam
);
srs_freep
(
pparam
);
}
// TODO: fork or vfork?
...
...
trunk/src/app/srs_app_forward.cpp
查看文件 @
befde6a
...
...
@@ -352,20 +352,33 @@ int SrsForwarder::forward()
srs_verbose
(
"no packets to forward."
);
continue
;
}
SrsAutoFree
(
SrsSharedPtrMessage
*
,
msgs
,
true
);
// all msgs to forward.
// @remark, becareful, all msgs must be free explicitly,
// free by send_and_free_message or srs_freep.
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
SrsSharedPtrMessage
*
msg
=
msgs
[
i
];
srs_assert
(
msg
);
msgs
[
i
]
=
NULL
;
// never use free msgs array, for it will memory leak.
// if error, directly free msgs.
if
(
ret
!=
ERROR_SUCCESS
)
{
srs_freep
(
msg
);
continue
;
}
if
((
ret
=
client
->
send_and_free_message
(
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"forwarder send message to server failed. ret=%d"
,
ret
);
return
ret
;
break
;
}
}
// free the array itself.
srs_freep
(
msgs
);
if
(
ret
!=
ERROR_SUCCESS
)
{
return
ret
;
}
}
return
ret
;
...
...
trunk/src/app/srs_app_http.cpp
查看文件 @
befde6a
...
...
@@ -523,7 +523,7 @@ SrsHttpMessage::~SrsHttpMessage()
srs_freep
(
_body
);
srs_freep
(
_uri
);
srs_freep
(
_match
);
srs_freep
a
(
_http_ts_send_buffer
);
srs_freep
(
_http_ts_send_buffer
);
}
char
*
SrsHttpMessage
::
http_ts_send_buffer
()
...
...
trunk/src/app/srs_app_log.cpp
查看文件 @
befde6a
...
...
@@ -72,7 +72,7 @@ SrsFastLog::SrsFastLog()
SrsFastLog
::~
SrsFastLog
()
{
srs_freep
a
(
log_data
);
srs_freep
(
log_data
);
if
(
fd
>
0
)
{
::
close
(
fd
);
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
befde6a
...
...
@@ -513,9 +513,10 @@ int SrsRtmpConn::playing(SrsSource* source)
srs_verbose
(
"no packets in queue."
);
continue
;
}
SrsAutoFree
(
SrsSharedPtrMessage
*
,
msgs
,
true
);
// sendout messages
// @remark, becareful, all msgs must be free explicitly,
// free by send_and_free_message or srs_freep.
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
SrsSharedPtrMessage
*
msg
=
msgs
[
i
];
...
...
@@ -525,6 +526,13 @@ int SrsRtmpConn::playing(SrsSource* source)
srs_assert
(
msg
);
// never use free msgs array, for it will memory leak.
// if error, directly free msgs.
if
(
ret
!=
ERROR_SUCCESS
)
{
srs_freep
(
msg
);
continue
;
}
// foreach msg, collect the duration.
// @remark: never use msg when sent it, for the protocol sdk will free it.
if
(
starttime
<
0
||
starttime
>
msg
->
header
.
timestamp
)
{
...
...
@@ -535,9 +543,14 @@ int SrsRtmpConn::playing(SrsSource* source)
if
((
ret
=
rtmp
->
send_and_free_message
(
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"send message to client failed. ret=%d"
,
ret
);
return
ret
;
break
;
}
}
// free the array itself.
srs_freep
(
msgs
);
if
(
ret
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// if duration specified, and exceed it, stop play live.
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/45
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
befde6a
...
...
@@ -844,7 +844,7 @@ int SrsSource::on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata)
char
*
payload
=
NULL
;
if
((
ret
=
metadata
->
encode
(
size
,
payload
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"encode metadata error. ret=%d"
,
ret
);
srs_freep
a
(
payload
);
srs_freep
(
payload
);
return
ret
;
}
srs_verbose
(
"encode metadata success."
);
...
...
trunk/src/core/srs_core.hpp
100755 → 100644
查看文件 @
befde6a
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_CORE_HPP
#define SRS_CORE_HPP
/*
#include <srs_core.hpp>
*/
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "94"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "srs"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
#define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(simple rtmp server)"
#define RTMP_SIG_SRS_URL_SHORT "github.com/winlinvip/simple-rtmp-server"
#define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT
#define RTMP_SIG_SRS_WEB "http://blog.csdn.net/win_lin"
#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com"
#define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)"
#define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin"
#define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao"
#define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt"
/**
* the core provides the common defined macros, utilities,
* user must include the srs_core.hpp before any header, or maybe
* build failed.
*/
// for 32bit os, 2G big file limit for unistd io,
// ie. read/write/lseek to use 64bits size for huge file.
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
// for int64_t print using PRId64 format.
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
#include <assert.h>
#define srs_assert(expression) assert(expression)
#include <stddef.h>
#include <sys/types.h>
// generated by configure.
#include <srs_auto_headers.hpp>
// free the p and set to NULL.
// p must be a T*.
#define srs_freep(p) \
if
(
p
)
{
\
delete
p
;
\
p
=
NULL
;
\
}
\
(
void
)
0
// free the p which represents a array
#define srs_freepa(p) \
if
(
p
)
{
\
delete
[]
p
;
\
p
=
NULL
;
\
}
\
(
void
)
0
// compare
#define srs_min(a, b) (((a) < (b))? (a) : (b))
#define srs_max(a, b) (((a) < (b))? (b) : (a))
// signal defines.
#define SIGNAL_RELOAD SIGHUP
#include <string>
// replace old_str to new_str of str
extern
std
::
string
srs_string_replace
(
std
::
string
str
,
std
::
string
old_str
,
std
::
string
new_str
);
// trim char in trim_chars of str
extern
std
::
string
srs_string_trim_end
(
std
::
string
str
,
std
::
string
trim_chars
);
// trim char in trim_chars of str
extern
std
::
string
srs_string_trim_start
(
std
::
string
str
,
std
::
string
trim_chars
);
// remove char in remove_chars of str
extern
std
::
string
srs_string_remove
(
std
::
string
str
,
std
::
string
remove_chars
);
// whether string end with
extern
bool
srs_string_ends_with
(
std
::
string
str
,
std
::
string
flag
);
// dns resolve utility, return the resolved ip address.
extern
std
::
string
srs_dns_resolve
(
std
::
string
host
);
// whether system is little endian
extern
bool
srs_is_little_endian
();
/**
* disable copy constructor of class
*/
#define disable_default_copy(className)\
private
:
\
/** \
* disable the copy constructor and operator=, donot allow directly copy. \
*/
\
className
(
const
className
&
);
\
className
&
operator
=
(
const
className
&
)
// const time for st to convert to us
#define SRS_TIME_MILLISECONDS 1000
#define SRS_TIME_SECONDS 1000000
#endif
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_CORE_HPP
#define SRS_CORE_HPP
/*
#include <srs_core.hpp>
*/
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "95"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "srs"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
#define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(simple rtmp server)"
#define RTMP_SIG_SRS_URL_SHORT "github.com/winlinvip/simple-rtmp-server"
#define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT
#define RTMP_SIG_SRS_WEB "http://blog.csdn.net/win_lin"
#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com"
#define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)"
#define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin"
#define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao"
#define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt"
/**
* the core provides the common defined macros, utilities,
* user must include the srs_core.hpp before any header, or maybe
* build failed.
*/
// for 32bit os, 2G big file limit for unistd io,
// ie. read/write/lseek to use 64bits size for huge file.
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
// for int64_t print using PRId64 format.
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
#include <assert.h>
#define srs_assert(expression) assert(expression)
#include <stddef.h>
#include <sys/types.h>
// generated by configure.
#include <srs_auto_headers.hpp>
// free the p and set to NULL.
// p must be a T*.
#define srs_freep(p) \
if (p) { \
delete p; \
p = NULL; \
} \
(void)0
// sometimes, the freepa is useless,
// it's recomments to free each elem explicit.
// so we remove the srs_freepa utility.
// compare
#define srs_min(a, b) (((a) < (b))? (a) : (b))
#define srs_max(a, b) (((a) < (b))? (b) : (a))
// signal defines.
#define SIGNAL_RELOAD SIGHUP
#include <string>
// replace old_str to new_str of str
extern
std
::
string
srs_string_replace
(
std
::
string
str
,
std
::
string
old_str
,
std
::
string
new_str
);
// trim char in trim_chars of str
extern
std
::
string
srs_string_trim_end
(
std
::
string
str
,
std
::
string
trim_chars
);
// trim char in trim_chars of str
extern
std
::
string
srs_string_trim_start
(
std
::
string
str
,
std
::
string
trim_chars
);
// remove char in remove_chars of str
extern
std
::
string
srs_string_remove
(
std
::
string
str
,
std
::
string
remove_chars
);
// whether string end with
extern
bool
srs_string_ends_with
(
std
::
string
str
,
std
::
string
flag
);
// dns resolve utility, return the resolved ip address.
extern
std
::
string
srs_dns_resolve
(
std
::
string
host
);
// whether system is little endian
extern
bool
srs_is_little_endian
();
/**
* disable copy constructor of class
*/
#define disable_default_copy(className)\
private:\
/** \
* disable the copy constructor and operator=, donot allow directly copy. \
*/
\
className(const className&); \
className& operator= (const className&)
// const time for st to convert to us
#define SRS_TIME_MILLISECONDS 1000
#define SRS_TIME_SECONDS 1000000
#endif
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
befde6a
...
...
@@ -340,7 +340,7 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data,
msg
=
new
SrsSharedPtrMessage
();
if
((
ret
=
msg
->
initialize
(
&
header
,
data
,
size
))
!=
ERROR_SUCCESS
)
{
srs_freep
a
(
data
);
srs_freep
(
data
);
return
ret
;
}
}
else
if
(
type
==
SRS_RTMP_TYPE_VIDEO
)
{
...
...
@@ -349,7 +349,7 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data,
msg
=
new
SrsSharedPtrMessage
();
if
((
ret
=
msg
->
initialize
(
&
header
,
data
,
size
))
!=
ERROR_SUCCESS
)
{
srs_freep
a
(
data
);
srs_freep
(
data
);
return
ret
;
}
}
else
if
(
type
==
SRS_RTMP_TYPE_SCRIPT
)
{
...
...
@@ -358,7 +358,7 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data,
msg
=
new
SrsSharedPtrMessage
();
if
((
ret
=
msg
->
initialize
(
&
header
,
data
,
size
))
!=
ERROR_SUCCESS
)
{
srs_freep
a
(
data
);
srs_freep
(
data
);
return
ret
;
}
}
...
...
@@ -370,7 +370,7 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data,
}
}
else
{
// directly free data if not sent out.
srs_freep
a
(
data
);
srs_freep
(
data
);
}
return
ret
;
...
...
trunk/src/rtmp/srs_protocol_handshake.cpp
查看文件 @
befde6a
...
...
@@ -336,10 +336,10 @@ namespace srs
void
srs_key_block_free
(
key_block
*
key
)
{
if
(
key
->
random0
)
{
srs_freep
a
(
key
->
random0
);
srs_freep
(
key
->
random0
);
}
if
(
key
->
random1
)
{
srs_freep
a
(
key
->
random1
);
srs_freep
(
key
->
random1
);
}
}
...
...
@@ -427,10 +427,10 @@ namespace srs
void
srs_digest_block_free
(
digest_block
*
digest
)
{
if
(
digest
->
random0
)
{
srs_freep
a
(
digest
->
random0
);
srs_freep
(
digest
->
random0
);
}
if
(
digest
->
random1
)
{
srs_freep
a
(
digest
->
random1
);
srs_freep
(
digest
->
random1
);
}
}
...
...
trunk/src/rtmp/srs_protocol_rtmp.cpp
查看文件 @
befde6a
...
...
@@ -192,9 +192,9 @@ SrsHandshakeBytes::SrsHandshakeBytes()
SrsHandshakeBytes
::~
SrsHandshakeBytes
()
{
srs_freepa
(
c0c1
);
srs_freepa
(
s0s1s2
);
srs_freepa
(
c2
);
srs_freep
(
c0c1
);
srs_freep
(
s0s1s2
);
srs_freep
(
c2
);
}
int
SrsHandshakeBytes
::
read_c0c1
(
ISrsProtocolReaderWriter
*
io
)
...
...
trunk/src/rtmp/srs_protocol_rtmp_stack.cpp
查看文件 @
befde6a
...
...
@@ -1538,7 +1538,7 @@ SrsCommonMessage::SrsCommonMessage()
SrsCommonMessage
::~
SrsCommonMessage
()
{
srs_freep
a
(
payload
);
srs_freep
(
payload
);
}
SrsSharedPtrMessage
::
__SrsSharedPtr
::
__SrsSharedPtr
()
...
...
@@ -1550,7 +1550,7 @@ SrsSharedPtrMessage::__SrsSharedPtr::__SrsSharedPtr()
SrsSharedPtrMessage
::
__SrsSharedPtr
::~
__SrsSharedPtr
()
{
srs_freep
a
(
payload
);
srs_freep
(
payload
);
}
SrsSharedPtrMessage
::
SrsSharedPtrMessage
()
...
...
@@ -1678,14 +1678,14 @@ int SrsPacket::encode(int& psize, char*& ppayload)
if
((
ret
=
stream
.
initialize
(
payload
,
size
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"initialize the stream failed. ret=%d"
,
ret
);
srs_freep
a
(
payload
);
srs_freep
(
payload
);
return
ret
;
}
}
if
((
ret
=
encode_packet
(
&
stream
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"encode the packet failed. ret=%d"
,
ret
);
srs_freep
a
(
payload
);
srs_freep
(
payload
);
return
ret
;
}
...
...
请
注册
或
登录
后发表评论