[Asterisk-code-review] format cap: Don't append the 'none' format when appending all. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Thu Nov 12 06:27:12 CST 2015


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/1612

Change subject: format_cap: Don't append the 'none' format when appending all.
......................................................................

format_cap: Don't append the 'none' format when appending all.

When appending all formats of a type all the codecs are iterated
and added. This operation was incorrectly adding the ast_format_none
format which is special in that it is supposed to be used when no
format is present. It shouldn't be appended.

ASTERISK-25535

Change-Id: I7b00f3bdf4a5f3022e483d6ece602b1e8b12827c
---
M main/format_cap.c
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/12/1612/1

diff --git a/main/format_cap.c b/main/format_cap.c
index 2221c53..9e16aa3 100644
--- a/main/format_cap.c
+++ b/main/format_cap.c
@@ -231,7 +231,15 @@
 		}
 
 		format = ast_format_cache_get(codec->name);
+
+		if (format == ast_format_none) {
+			ao2_ref(format, -1);
+			ao2_ref(codec, -1);
+			continue;
+		}
+
 		if (!format || (codec != ast_format_get_codec(format))) {
+			ao2_cleanup(format);
 			format = ast_format_create(codec);
 		}
 		ao2_ref(codec, -1);

-- 
To view, visit https://gerrit.asterisk.org/1612
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b00f3bdf4a5f3022e483d6ece602b1e8b12827c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list