[asterisk-commits] rmudgett: trunk r399597 - in /trunk: ./ main/media_index.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 20 20:46:57 CDT 2013
Author: rmudgett
Date: Fri Sep 20 20:46:56 2013
New Revision: 399597
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399597
Log:
media_index: Fix process_description_file() memory leak of file_id_persist.
........
Merged revisions 399596 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
trunk/ (props changed)
trunk/main/media_index.c
Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Fri Sep 20 20:46:56 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399100,399136,399146,399160,399197,399207,399225,399237,399247,399257,399268,399283,399294,399339,399365,399376,399404,399458,399501,399514,399531,399553,399565,399576,399583,399585
+/branches/12:1-398558,398560-398577,398579-399100,399136,399146,399160,399197,399207,399225,399237,399247,399257,399268,399283,399294,399339,399365,399376,399404,399458,399501,399514,399531,399553,399565,399576,399583,399585,399596
Modified: trunk/main/media_index.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/media_index.c?view=diff&rev=399597&r1=399596&r2=399597
==============================================================================
--- trunk/main/media_index.c (original)
+++ trunk/main/media_index.c Fri Sep 20 20:46:56 2013
@@ -439,6 +439,7 @@
/* if there's text in cumulative_description, archive it and start anew */
if (file_id_persist && !ast_strlen_zero(ast_str_buffer(cumulative_description))) {
RAII_VAR(struct media_variant *, variant, NULL, ao2_cleanup);
+
variant = find_variant(index, file_id_persist, variant_str);
if (!variant) {
variant = alloc_variant(index, file_id_persist, variant_str);
@@ -451,11 +452,10 @@
ast_string_field_set(variant, description, ast_str_buffer(cumulative_description));
ast_str_reset(cumulative_description);
- ast_free(file_id_persist);
- file_id_persist = NULL;
- }
-
- file_id_persist = strdup(file_identifier);
+ }
+
+ ast_free(file_id_persist);
+ file_id_persist = ast_strdup(file_identifier);
description = ast_skip_blanks(description);
ast_str_set(&cumulative_description, 0, "%s", description);
}
@@ -464,6 +464,7 @@
/* handle the last one */
if (file_id_persist && !ast_strlen_zero(ast_str_buffer(cumulative_description))) {
RAII_VAR(struct media_variant *, variant, NULL, ao2_cleanup);
+
variant = find_variant(index, file_id_persist, variant_str);
if (!variant) {
variant = alloc_variant(index, file_id_persist, variant_str);
@@ -471,12 +472,12 @@
if (variant) {
ast_string_field_set(variant, description, ast_str_buffer(cumulative_description));
- ast_free(file_id_persist);
} else {
res = -1;
}
}
+ ast_free(file_id_persist);
fclose(f);
return res;
}
More information about the asterisk-commits
mailing list