|
|
@@ -30,6 +30,7 @@ struct SourceMetadata {
|
|
|
}
|
|
|
|
|
|
SourceMetadata(const char* source, _Str filename, CompileMode mode) {
|
|
|
+ source = strdup(source);
|
|
|
// Skip utf8 BOM if there is any.
|
|
|
if (strncmp(source, "\xEF\xBB\xBF", 3) == 0) source += 3;
|
|
|
this->filename = filename;
|
|
|
@@ -46,6 +47,10 @@ struct SourceMetadata {
|
|
|
ss << " " << line << '\n';
|
|
|
return ss.str();
|
|
|
}
|
|
|
+
|
|
|
+ ~SourceMetadata(){
|
|
|
+ free((void*)source);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
typedef std::shared_ptr<SourceMetadata> _Source;
|