aboutsummaryrefslogtreecommitdiff
path: root/ssl/d1_srtp.cc
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2017-09-21 02:11:35 -0400
committerCQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>2017-09-22 15:15:48 +0000
commit38570b26b88a705064a2753feb9233319f796f7b (patch)
tree7f482c33bb1f94afeefeeea855f55198f530a59c /ssl/d1_srtp.cc
parentb7e5b08a20a45793c74f18e375acd34faaf896b2 (diff)
downloadboringssl-38570b26b88a705064a2753feb9233319f796f7b.zip
boringssl-38570b26b88a705064a2753feb9233319f796f7b.tar.gz
boringssl-38570b26b88a705064a2753feb9233319f796f7b.tar.bz2
Clear a goto in d1_srtp.cc.
Bug: 132 Change-Id: I4ba12f1dfbbdc75cb3841dc70f9007bd8695da97 Reviewed-on: https://boringssl-review.googlesource.com/20665 Reviewed-by: Steven Valdez <svaldez@google.com> Commit-Queue: David Benjamin <davidben@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Diffstat (limited to 'ssl/d1_srtp.cc')
-rw-r--r--ssl/d1_srtp.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/ssl/d1_srtp.cc b/ssl/d1_srtp.cc
index 30733ec..1a8e084 100644
--- a/ssl/d1_srtp.cc
+++ b/ssl/d1_srtp.cc
@@ -160,9 +160,9 @@ static int find_profile_by_name(const char *profile_name,
static int ssl_ctx_make_profiles(const char *profiles_string,
STACK_OF(SRTP_PROTECTION_PROFILE) **out) {
- STACK_OF(SRTP_PROTECTION_PROFILE) *profiles =
- sk_SRTP_PROTECTION_PROFILE_new_null();
- if (profiles == NULL) {
+ UniquePtr<STACK_OF(SRTP_PROTECTION_PROFILE)> profiles(
+ sk_SRTP_PROTECTION_PROFILE_new_null());
+ if (profiles == nullptr) {
OPENSSL_PUT_ERROR(SSL, SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES);
return 0;
}
@@ -176,11 +176,11 @@ static int ssl_ctx_make_profiles(const char *profiles_string,
if (!find_profile_by_name(ptr, &profile,
col ? (size_t)(col - ptr) : strlen(ptr))) {
OPENSSL_PUT_ERROR(SSL, SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE);
- goto err;
+ return 0;
}
- if (!sk_SRTP_PROTECTION_PROFILE_push(profiles, profile)) {
- goto err;
+ if (!sk_SRTP_PROTECTION_PROFILE_push(profiles.get(), profile)) {
+ return 0;
}
if (col) {
@@ -189,12 +189,8 @@ static int ssl_ctx_make_profiles(const char *profiles_string,
} while (col);
sk_SRTP_PROTECTION_PROFILE_free(*out);
- *out = profiles;
+ *out = profiles.release();
return 1;
-
-err:
- sk_SRTP_PROTECTION_PROFILE_free(profiles);
- return 0;
}
int SSL_CTX_set_srtp_profiles(SSL_CTX *ctx, const char *profiles) {