[Asterisk-code-review] res pjproject: Handle error from adding to the buildopts vec... (asterisk[master])

Joshua Colp asteriskteam at digium.com
Tue Nov 7 05:41:24 CST 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/7055 )

Change subject: res_pjproject: Handle error from adding to the buildopts vector.
......................................................................

res_pjproject: Handle error from adding to the buildopts vector.

Change-Id: I076c7bd207c7989a23005395ce1735392657be65
---
M res/res_pjproject.c
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/res/res_pjproject.c b/res/res_pjproject.c
index 46c82aa..86b2502 100644
--- a/res/res_pjproject.c
+++ b/res/res_pjproject.c
@@ -227,11 +227,16 @@
 
 static void capture_buildopts_cb(int level, const char *data, int len)
 {
+	char *dup;
+
 	if (strstr(data, "Teluu") || strstr(data, "Dumping")) {
 		return;
 	}
 
-	AST_VECTOR_ADD_SORTED(&buildopts, ast_strdup(ast_skip_blanks(data)), strcmp);
+	dup = ast_strdup(ast_skip_blanks(data));
+	if (AST_VECTOR_ADD_SORTED(&buildopts, dup, strcmp)) {
+		ast_free(dup);
+	}
 }
 
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I076c7bd207c7989a23005395ce1735392657be65
Gerrit-Change-Number: 7055
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171107/33c21656/attachment-0001.html>


More information about the asterisk-code-review mailing list