Skip to content

Commit

Permalink
Fix source_c_str handling (don't copy since it is char*)
Browse files Browse the repository at this point in the history
Addresses sass#869

This is a breaking change since implementers need to
make a copy of the string if they are not able to pass
the complete memory ownership to libsass.
  • Loading branch information
mgreter committed Mar 7, 2015
1 parent 441c1ca commit e45ca94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,10 @@ namespace Sass {
if(is_indented_syntax_src) {
char * contents = sass2scss(source_c_str, SASS2SCSS_PRETTIFY_1 | SASS2SCSS_KEEP_COMMENT);
add_source(input_path, input_path, contents);
delete [] source_c_str;
return parse_file();
}
add_source(input_path, input_path, sass_strdup(source_c_str));
add_source(input_path, input_path, source_c_str);
return parse_file();
}

Expand Down
2 changes: 1 addition & 1 deletion sass_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ return 0;

struct string_list* plugin_path = (struct string_list*) calloc(1, sizeof(struct string_list));
if (plugin_path == 0) return;
plugin_path->string = path ? copy_c_str(path) : 0;
plugin_path->string = path ? sass_strdup(path) : 0;
struct string_list* last = options->plugin_paths;
if (!options->plugin_paths) {
options->plugin_paths = plugin_path;
Expand Down

0 comments on commit e45ca94

Please sign in to comment.