Prevent potential double-free if srtp_create fails.

If srtp_create fails while adding streams, it deallocates the session
but doesn't clear the passed pointer which then could lead to a
double-free in the SrtpSession dtor.

The CL also adds locking for libsrtp initialization / shutdown.

BUG=4042
R=jiayl@webrtc.org, juberti@google.com, pthatcher@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/47319004

Cr-Commit-Position: refs/heads/master@{#9300}
4 files changed