summaryrefslogtreecommitdiff
path: root/modules/mpa/decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mpa/decode.c')
-rw-r--r--modules/mpa/decode.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/mpa/decode.c b/modules/mpa/decode.c
index 7dfaccb..8a92fbc 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;