summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChristian Hoene <christian.hoene@symonics.com>2016-05-25 08:42:53 +0200
committerChristian Hoene <christian.hoene@symonics.com>2016-05-25 08:42:53 +0200
commitfa7f754289007ab46857db7821fe9bd04a67da5f (patch)
treee8a304010fde3f3ae49964aeb0f48fdb24b2f34d /modules
parent433a2349b5487251aa6e5190476a457e90f9dbe2 (diff)
Bug with reinit of codec structs
Diffstat (limited to 'modules')
-rw-r--r--modules/mpa/decode.c14
-rw-r--r--modules/mpa/encode.c10
2 files changed, 15 insertions, 9 deletions
diff --git a/modules/mpa/decode.c b/modules/mpa/decode.c
index b71a335..6e5b71e 100644
--- a/modules/mpa/decode.c
+++ b/modules/mpa/decode.c
@@ -51,12 +51,14 @@ int mpa_decode_update(struct audec_state **adsp, const struct aucodec *ac,
debug("MPA dec created %s\n",fmtp);
#endif
- if (ads)
- mem_deref(ads);
-
- ads = mem_zalloc(sizeof(*ads), destructor);
- if (!ads)
- return ENOMEM;
+ if (!ads) {
+ ads = mem_zalloc(sizeof(*ads), destructor);
+ if (!ads)
+ return ENOMEM;
+ }
+ else {
+ memset(ads,0,sizeof(*ads));
+ }
ads->channels = 0;
ads->resampler = NULL;
ads->start = 0;
diff --git a/modules/mpa/encode.c b/modules/mpa/encode.c
index 21a34c0..ec0b0a2 100644
--- a/modules/mpa/encode.c
+++ b/modules/mpa/encode.c
@@ -49,11 +49,15 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
return EINVAL;
aes = *aesp;
- if (aes) {
- mem_deref(aes);
+ if (!aes) {
+ aes = mem_zalloc(sizeof(*aes), destructor);
+ if (!aes)
+ return ENOMEM;
+
}
+ else
+ memset(aes,0,sizeof(*aes));
- aes = mem_zalloc(sizeof(*aes), destructor);
aes->enc = twolame_init();
if (!aes->enc) {
error("MPA enc create failed\n");