res_pjproject: Handle error from adding to the buildopts vector.
authorCorey Farrell <git@cfware.com>
Mon, 6 Nov 2017 23:17:13 +0000 (18:17 -0500)
committerCorey Farrell <git@cfware.com>
Mon, 6 Nov 2017 23:17:13 +0000 (18:17 -0500)
Change-Id: I076c7bd207c7989a23005395ce1735392657be65

res/res_pjproject.c

index 46c82aa..86b2502 100644 (file)
@@ -227,11 +227,16 @@ static void log_forwarder(int level, const char *data, int len)
 
 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"