summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-07-12 09:01:48 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-07-12 09:01:48 +0200
commit8393d8ca08beb7d4aef39e7292b7e1b31c54e29d (patch)
tree0b953780dc61b2f4750dfea04775a5276f7f744e
parent152185acba44d75fca755fe3804e95c4e9f54c95 (diff)
downloadODR-AudioEnc-8393d8ca08beb7d4aef39e7292b7e1b31c54e29d.tar.gz
ODR-AudioEnc-8393d8ca08beb7d4aef39e7292b7e1b31c54e29d.tar.bz2
ODR-AudioEnc-8393d8ca08beb7d4aef39e7292b7e1b31c54e29d.zip
Avoid crash on AAC encoder destruction if not initialised
-rw-r--r--src/odr-audioenc.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/odr-audioenc.cpp b/src/odr-audioenc.cpp
index bfc7738..0c7c9c3 100644
--- a/src/odr-audioenc.cpp
+++ b/src/odr-audioenc.cpp
@@ -472,7 +472,7 @@ public:
SampleQueue<uint8_t> queue;
- HANDLE_AACENCODER encoder;
+ HANDLE_AACENCODER encoder = nullptr;
unique_ptr<AACDecoder> decoder;
unique_ptr<StatsPublisher> stats_publisher;
@@ -1249,7 +1249,7 @@ AudioEnc::~AudioEnc()
free_rs_char(rs_handler);
}
- if (selected_encoder == encoder_selection_t::fdk_dabplus) {
+ if (encoder != nullptr and selected_encoder == encoder_selection_t::fdk_dabplus) {
aacEncClose(&encoder);
}
}