@@ -134,14 +134,19 @@ bool application::cmd(std::vector<std::string> &arguments)
134134 /* Initialize CMD descriptors */
135135 std::string plugin_path (metacall_plugin_path ());
136136
137- void *args [] = {
137+ void *command_initialize_args [] = {
138138 metacall_value_create_string (plugin_path.c_str (), plugin_path.length ())
139139 };
140140
141- void *command_initialize_ret = metacallhv_s (plugin_cli_handle, " command_initialize" , args , sizeof (args ) / sizeof (args [0 ]));
141+ void *command_initialize_ret = metacallhv_s (plugin_cli_handle, " command_initialize" , command_initialize_args , sizeof (command_initialize_args ) / sizeof (command_initialize_args [0 ]));
142142
143143 check_for_exception (command_initialize_ret);
144144
145+ for (void *arg : command_initialize_args)
146+ {
147+ metacall_value_destroy (arg);
148+ }
149+
145150 /* Convert all arguments into metacall value strings */
146151 std::vector<void *> arguments_values;
147152 arguments_values.reserve (arguments.size ());
@@ -179,11 +184,11 @@ bool application::cmd(std::vector<std::string> &arguments)
179184 {
180185 void **command_pair = metacall_value_to_array (command_map[iterator]);
181186
182- void *args [] = {
187+ void *command_args [] = {
183188 command_pair[0 ]
184189 };
185190
186- void *command_func = metacallfv_s (command_function_func, args , sizeof (args ) / sizeof (args [0 ]));
191+ void *command_func = metacallfv_s (command_function_func, command_args , sizeof (command_args ) / sizeof (command_args [0 ]));
187192
188193 if (metacall_value_id (command_func) == METACALL_FUNCTION)
189194 {
0 commit comments