- /* make room for all socket ownership descriptions */
- TRY(gras_dynar_new(&_gras_trp_sockets, sizeof(gras_socket_t*), NULL));
+ DEBUG1("Create plugin %s",name);
+
+ if (!plug)
+ RAISE_MALLOC;
+
+ memset(plug,0,sizeof(gras_trp_plugin_t));
+
+ plug->name=strdup(name);
+ if (!plug->name)
+ RAISE_MALLOC;
+
+ errcode = setup(plug);
+ switch (errcode) {
+ case mismatch_error:
+ /* SG plugin return mismatch when in RL mode (and vice versa) */
+ free(plug->name);
+ free(plug);
+ break;
+
+ case no_error:
+ TRY(gras_dict_set(_gras_trp_plugins,
+ name, plug, gras_trp_plugin_free));
+ break;
+
+ default:
+ free(plug);
+ return errcode;
+ }
+ return no_error;
+}