summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-12-10 15:02:25 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-12-10 15:02:25 +0100
commit8da2861036b14da10498635d2c38cc876e83ac89 (patch)
tree39b392b8b8ede2b910f87b59e403fb5932fbb9c2 /src
parentac98c2f1a5527e0a2e7d81de5aa6d610eb115f65 (diff)
Get rid of var stack alloc (doesn't work with msvc.)
Diffstat (limited to 'src')
-rw-r--r--src/lrtp.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lrtp.cc b/src/lrtp.cc
index 9447032..da02083 100644
--- a/src/lrtp.cc
+++ b/src/lrtp.cc
@@ -273,7 +273,7 @@ int lrtp_unpack(struct lrtp_t *lrtp, const char *packet, size_t size)
// TODO: Check lrtp magic word
- char pkg[size];
+ char *pkg = (char*)malloc(size);
memcpy(pkg, packet, size);
int ret = 0;
@@ -283,6 +283,7 @@ int lrtp_unpack(struct lrtp_t *lrtp, const char *packet, size_t size)
if(ret < 0) {
printf("lrtp_unpack::decrypt error: %d\n", ret);
+ free(pkg);
return -1;
}
@@ -292,13 +293,20 @@ int lrtp_unpack(struct lrtp_t *lrtp, const char *packet, size_t size)
RTP rtp;
rtp.fromPacket(pkg, size);
std::list<csrc_t> csrcs = rtp.getCSrcs();
- if(csrcs.size() == 0) return -UNPACK_MISSING_CSRC;
- if(csrcs.size() > 1) return -UNPACK_TOO_MANY_CSRCS;
+ if(csrcs.size() == 0) {
+ free(pkg);
+ return -UNPACK_MISSING_CSRC;
+ }
+ if(csrcs.size() > 1) {
+ free(pkg);
+ return -UNPACK_TOO_MANY_CSRCS;
+ }
csrc_t csrc = *csrcs.begin();
struct lrtp_profile_t *profile = NULL;
if(lrtp->profiles.find(csrc) == lrtp->profiles.end()) {
+ free(pkg);
return -UNPACK_MISSING_PROFILE;
}
@@ -309,6 +317,7 @@ int lrtp_unpack(struct lrtp_t *lrtp, const char *packet, size_t size)
if(ret < 0) {
printf("lrtp_unpack::Profile unpack failed: %d\n", ret);
+ free(pkg);
return -1;
}
@@ -321,6 +330,8 @@ int lrtp_unpack(struct lrtp_t *lrtp, const char *packet, size_t size)
lrtp->framelist.splice(lrtp->framelist.end(), framelist);
+ free(pkg);
+
return ret;
}