]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_fax_spandsp: Properly handle cleanup before starting FAXes.
authorMark Michelson <mmichelson@digium.com>
Thu, 18 Sep 2014 16:19:51 +0000 (16:19 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 18 Sep 2014 16:19:51 +0000 (16:19 +0000)
If faxing fails at a very early stage, then it is possible for
us to pass a NULL t30 state pointer to spandsp, which spandsp
is none too pleased with.

This patch ensures that we pass the correct pointer to spandsp
in the situation where we have not yet set our local t30 state
pointer.

ASTERISK-24301 #close
Reported by Matt Jordan
Patches:
ASTERISK-24301-fax.diff Uploaded by Mark Michelson (License #5049)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@423360 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_fax_spandsp.c

index 2226d20c4c35f1ca5d5812de965c438d63d55af2..bc3b810adb2c9342556436ad2bb1c5c495c3008e 100644 (file)
@@ -176,8 +176,25 @@ static void set_ecm(t30_state_t *t30_state, struct ast_fax_session_details *deta
 static void session_destroy(struct spandsp_pvt *p)
 {
        struct ast_frame *f;
+       t30_state_t *t30_to_terminate;
 
-       t30_terminate(p->t30_state);
+       if (p->t30_state) {
+               t30_to_terminate = p->t30_state;
+       } else if (p->ist38) {
+#if SPANDSP_RELEASE_DATE >= 20080725
+               t30_to_terminate = &p->t38_state.t30;
+#else
+               t30_to_terminate = &p->t38_state.t30_state;
+#endif
+       } else {
+#if SPANDSP_RELEASE_DATE >= 20080725
+               t30_to_terminate = &p->fax_state.t30;
+#else
+               t30_to_terminate = &p->fax_state.t30_state;
+#endif
+       }
+
+       t30_terminate(t30_to_terminate);
        p->isdone = 1;
 
        ast_timer_close(p->timer);