Browse Source

Don't load plugin if slug already exists

pull/1639/head
Andrew Belt 7 years ago
parent
commit
285a6a830b
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      src/plugin.cpp

+ 10
- 0
src/plugin.cpp View File

@@ -144,6 +144,16 @@ static int loadPlugin(std::string path) {
plugin->handle = handle;
initCallback(plugin);

// Reject plugin if slug already exists
for (Plugin *p : gPlugins) {
if (plugin->slug == p->slug) {
warn("Plugin \"%s\" is already loaded, not attempting to load it again");
// TODO
// Fix memory leak with `plugin` here
return -1;
}
}

// Add plugin to list
gPlugins.push_back(plugin);
info("Loaded plugin %s", libraryFilename.c_str());


Loading…
Cancel
Save