Skip to content

Fix memory leak in msc_rules_* C APIs #1765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/rules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ extern "C" int msc_rules_merge(Rules *rules_dst,
Rules *rules_from, const char **error) {
int ret = rules_dst->merge(rules_from);
if (ret < 0) {
*error = strdup(rules_dst->getParserError().c_str());
*error = rules_dst->getParserError().c_str();
}
return ret;
}
Expand All @@ -331,7 +331,7 @@ extern "C" int msc_rules_add_remote(Rules *rules,
const char *key, const char *uri, const char **error) {
int ret = rules->loadRemote(key, uri);
if (ret < 0) {
*error = strdup(rules->getParserError().c_str());
*error = rules->getParserError().c_str();
}
return ret;
}
Expand All @@ -341,7 +341,7 @@ extern "C" int msc_rules_add_file(Rules *rules, const char *file,
const char **error) {
int ret = rules->loadFromUri(file);
if (ret < 0) {
*error = strdup(rules->getParserError().c_str());
*error = rules->getParserError().c_str();
}
return ret;
}
Expand All @@ -351,7 +351,7 @@ extern "C" int msc_rules_add(Rules *rules, const char *plain_rules,
const char **error) {
int ret = rules->load(plain_rules);
if (ret < 0) {
*error = strdup(rules->getParserError().c_str());
*error = rules->getParserError().c_str();
}
return ret;
}
Expand Down