core: Fix multiple trivial issues in the core.

* Fix small leaks in from error conditions in sdp.c and translate.c.
* Check new file descriptor is less than 0, not less than or equal.

Change-Id: Id7782775486175c739e0c4bf3ea5e17e3f452a99
pull/9/head
Corey Farrell 7 years ago
parent 11a1e07ad2
commit bf33a09c37

@ -845,6 +845,7 @@ static struct ast_stream *get_stream_from_m(const struct ast_sdp_a_lines *a_line
rtp_codecs_free(codecs);
ast_stream_free(stream);
ao2_ref(caps, -1);
ast_free(codecs);
return NULL;
}
ast_stream_set_data(stream, AST_STREAM_DATA_RTP_CODECS, codecs,

@ -497,6 +497,7 @@ struct ast_trans_pvt *ast_translator_build_path(struct ast_format *dst, struct a
ast_log(LOG_WARNING, "No translator path from %s to %s\n",
ast_format_get_name(src), ast_format_get_name(dst));
AST_RWLIST_UNLOCK(&translators);
ast_translator_free_path(head);
return NULL;
}
if ((t->dst_codec.sample_rate == ast_format_get_sample_rate(dst)) && (t->dst_codec.type == ast_format_get_type(dst))) {
@ -505,9 +506,7 @@ struct ast_trans_pvt *ast_translator_build_path(struct ast_format *dst, struct a
if (!(cur = newpvt(t, explicit_dst))) {
ast_log(LOG_WARNING, "Failed to build translator step from %s to %s\n",
ast_format_get_name(src), ast_format_get_name(dst));
if (head) {
ast_translator_free_path(head);
}
ast_translator_free_path(head);
AST_RWLIST_UNLOCK(&translators);
return NULL;
}

@ -2615,7 +2615,7 @@ void ast_set_default_eid(struct ast_eid *eid)
unsigned char full_mac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
s = socket(AF_INET, SOCK_STREAM, 0);
if (s <= 0) {
if (s < 0) {
ast_log(LOG_WARNING, "Unable to open socket for seeding global EID. "
"You will have to set it manually.\n");
return;

Loading…
Cancel
Save