aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/sigProcLib.cpp
diff options
context:
space:
mode:
authorTom Tsou <tom.tsou@ettus.com>2017-03-28 15:22:01 -0700
committerTom Tsou <tom@tsou.cc>2017-03-31 21:41:04 +0000
commit92bdfb86ac0ab468586698d068035447b1daf93b (patch)
treeb19780db7a281b1751dcc3d8d89054041345bf73 /Transceiver52M/sigProcLib.cpp
parentae91f13ecb8a3db44edad5b41963f59efe3504c1 (diff)
sigProcLib: Check return status on downsampling
Improper length values will cause the polyphase resampler rotation to fail. Check return and return NULL on error. Change-Id: I3ad22f9fd7a20754f589c04258dcca3770474a9b Fixes: Coverity CID 165235
Diffstat (limited to 'Transceiver52M/sigProcLib.cpp')
-rw-r--r--Transceiver52M/sigProcLib.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index 9673d99..4bb41a9 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -1962,8 +1962,12 @@ signalVector *downsampleBurst(const signalVector &burst)
out = new signalVector(DOWNSAMPLE_OUT_LEN);
memcpy(in->begin(), burst.begin(), DOWNSAMPLE_IN_LEN * 2 * sizeof(float));
- dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN,
- (float *) out->begin(), DOWNSAMPLE_OUT_LEN);
+ if (dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN,
+ (float *) out->begin(), DOWNSAMPLE_OUT_LEN) < 0) {
+ delete out;
+ out = NULL;
+ }
+
delete in;
return out;
};