Skip to content

Commit

Permalink
fix: memory issue for prefix (ElektraInitiative#3486)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmakar committed May 3, 2023
1 parent af417ea commit c88eeaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions scripts/cmake/Modules/LibAddPlugin.cmake
Expand Up @@ -637,8 +637,8 @@ function (add_plugin PLUGIN_SHORT_NAME)

if (BUILD_SHARED)
add_library (${PLUGIN_NAME} MODULE ${ARG_SOURCES} ${ARG_OBJECT_SOURCES})
# switch to -plugin- in CMake targets
set_target_properties(${PLUGIN_NAME} PROPERTIES OUTPUT_NAME "elektra-plugin-${PLUGIN_NAME}")
# TODO: switch to -plugin- in CMake targets
set_target_properties(${PLUGIN_NAME} PROPERTIES OUTPUT_NAME "plugin-${PLUGIN_NAME}")

if (ARG_DEPENDS)
add_dependencies (${PLUGIN_NAME} ${ARG_DEPENDS})
Expand Down
5 changes: 2 additions & 3 deletions src/libs/loader/dl.c
Expand Up @@ -70,10 +70,9 @@ elektraPluginFactory elektraModulesLoad (KeySet * modules, const char * name, Ke
return module->symbol.f;
}

char * moduleName = elektraMalloc (sizeof ("libelektra-") + strlen (name) + sizeof (elektraPluginPostfix) + 1);
char * moduleName = elektraMalloc (sizeof ("libelektra-plugin-") + strlen (name) + sizeof (elektraPluginPostfix) + 1);

strcpy (moduleName, "libelektra-");
strcat (moduleName, "plugin-");
strcpy (moduleName, "libelektra-plugin-");
strcat (moduleName, name);
strcat (moduleName, elektraPluginPostfix);

Expand Down

0 comments on commit c88eeaa

Please sign in to comment.