summaryrefslogtreecommitdiffstats
path: root/ssl/d1_srtp.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2016-06-04 00:15:19 +0200
committerMatt Caswell <matt@openssl.org>2016-06-23 14:03:29 +0100
commit3c82e437bb3af822ea13cd5a24bab0745c556246 (patch)
treefd9f622667bf9080451b96bc82e3715d23c31daa /ssl/d1_srtp.c
parent687b48685931638ca5fca2a7d5e13516ad40ea4b (diff)
Add checks on sk_TYPE_push() returned result
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'ssl/d1_srtp.c')
-rw-r--r--ssl/d1_srtp.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ssl/d1_srtp.c b/ssl/d1_srtp.c
index 91d373fdf4..94c0127312 100644
--- a/ssl/d1_srtp.c
+++ b/ssl/d1_srtp.c
@@ -81,16 +81,18 @@ static int ssl_ctx_make_profiles(const char *profiles_string,
if (sk_SRTP_PROTECTION_PROFILE_find(profiles, p) >= 0) {
SSLerr(SSL_F_SSL_CTX_MAKE_PROFILES,
SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
- sk_SRTP_PROTECTION_PROFILE_free(profiles);
- return 1;
+ goto err;
}
- sk_SRTP_PROTECTION_PROFILE_push(profiles, p);
+ if (!sk_SRTP_PROTECTION_PROFILE_push(profiles, p)) {
+ SSLerr(SSL_F_SSL_CTX_MAKE_PROFILES,
+ SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES);
+ goto err;
+ }
} else {
SSLerr(SSL_F_SSL_CTX_MAKE_PROFILES,
SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE);
- sk_SRTP_PROTECTION_PROFILE_free(profiles);
- return 1;
+ goto err;
}
if (col)
@@ -102,6 +104,9 @@ static int ssl_ctx_make_profiles(const char *profiles_string,
*out = profiles;
return 0;
+err:
+ sk_SRTP_PROTECTION_PROFILE_free(profiles);
+ return 1;
}
int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles)