Skip to content

Commit c930de4

Browse files
committed
Fix Memory Leak
include_paths was leaking
1 parent 3054e97 commit c930de4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/sass_context.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ extern "C" {
220220
size_t imp_size = 0; while (imp) { imp_size ++; imp = imp->next; }
221221
// create char* array to hold all paths plus null terminator
222222
const char** plugin_paths = (const char**) calloc(imp_size + 1, sizeof(char*));
223-
if (plugin_paths == 0) throw(std::bad_alloc());
223+
if (plugin_paths == 0){
224+
free(include_paths); //free include_paths before throw
225+
throw(std::bad_alloc());
226+
}
224227
// reset iterator
225228
imp = c_ctx->plugin_paths;
226229
// copy over the paths

0 commit comments

Comments
 (0)