Skip to content

Commit

Permalink
call ops->fini() only when implemented by the plugin
Browse files Browse the repository at this point in the history
Fixes #93
  • Loading branch information
merge committed Apr 25, 2017
1 parent 424d378 commit e684df5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/ts_close.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ int ts_close(struct tsdev *ts)
next = info->next;

handle = info->handle;
info->ops->fini(info);

if (info->ops->fini)
info->ops->fini(info);

if (handle)
dlclose(handle);

Expand Down
5 changes: 4 additions & 1 deletion src/ts_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ int ts_reconfig(struct tsdev *ts)
next = info->next;

handle = info->handle;
info->ops->fini(info);

if (info->ops->fini)
info->ops->fini(info);

if (handle)
dlclose(handle);

Expand Down
5 changes: 4 additions & 1 deletion src/ts_load_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ static int __ts_load_module(struct tsdev *ts, const char *module,
fprintf(stderr, "Can't attach %s\n", module);
#endif
handle = info->handle;
info->ops->fini(info);

if (info->ops->fini)
info->ops->fini(info);

if (handle)
dlclose(handle);
}
Expand Down

0 comments on commit e684df5

Please sign in to comment.