Skip to content

Commit a7f92f6

Browse files
authored
Merge pull request #2554 from mgreter/bugfix/mem-leak-custom-fn-sig
Fix memory leak of custom functions signature
2 parents a68d8bb + a536885 commit a7f92f6

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

src/sass_context.cpp

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -534,30 +534,10 @@ extern "C" {
534534
static void sass_clear_options (struct Sass_Options* options)
535535
{
536536
if (options == 0) return;
537-
// Deallocate custom functions
538-
if (options->c_functions) {
539-
Sass_Function_List this_func_data = options->c_functions;
540-
while (this_func_data && *this_func_data) {
541-
free(*this_func_data);
542-
++this_func_data;
543-
}
544-
}
545-
// Deallocate custom headers
546-
if (options->c_headers) {
547-
Sass_Importer_List this_head_data = options->c_headers;
548-
while (this_head_data && *this_head_data) {
549-
free(*this_head_data);
550-
++this_head_data;
551-
}
552-
}
553-
// Deallocate custom importers
554-
if (options->c_importers) {
555-
Sass_Importer_List this_imp_data = options->c_importers;
556-
while (this_imp_data && *this_imp_data) {
557-
free(*this_imp_data);
558-
++this_imp_data;
559-
}
560-
}
537+
// Deallocate custom functions, headers and importes
538+
sass_delete_function_list(options->c_functions);
539+
sass_delete_importer_list(options->c_importers);
540+
sass_delete_importer_list(options->c_headers);
561541
// Deallocate inc paths
562542
if (options->plugin_paths) {
563543
struct string_list* cur;

0 commit comments

Comments
 (0)