res_pjsip.c: Add missing off nominal cleanup in ast_sip_push_task_synchronous().
authorRichard Mudgett <rmudgett@digium.com>
Thu, 25 Sep 2014 21:03:51 +0000 (21:03 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 25 Sep 2014 21:03:51 +0000 (21:03 +0000)
* Made memset the std struct in ast_sip_push_task_synchronous() because if
DEBUG_THREADS is enabled then uninitialized lock tracking data is used.
........

Merged revisions 423894 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 423895 from http://svn.asterisk.org/svn/asterisk/branches/13

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

res/res_pjsip.c

index 87a1c82..b87be91 100644 (file)
@@ -2786,18 +2786,22 @@ int ast_sip_push_task_synchronous(struct ast_taskprocessor *serializer, int (*si
                return sip_task(task_data);
        }
 
+       memset(&std, 0, sizeof(std));
        ast_mutex_init(&std.lock);
        ast_cond_init(&std.cond, NULL);
-       std.fail = std.complete = 0;
        std.task = sip_task;
        std.task_data = task_data;
 
        if (serializer) {
                if (ast_taskprocessor_push(serializer, sync_task, &std)) {
+                       ast_mutex_destroy(&std.lock);
+                       ast_cond_destroy(&std.cond);
                        return -1;
                }
        } else {
                if (ast_threadpool_push(sip_threadpool, sync_task, &std)) {
+                       ast_mutex_destroy(&std.lock);
+                       ast_cond_destroy(&std.cond);
                        return -1;
                }
        }