Skip to content

Commit

Permalink
Merge pull request #7 from dougg3/master
Browse files Browse the repository at this point in the history
ts_close segfault fix
  • Loading branch information
kergoth committed Mar 21, 2013
2 parents b8ef1eb + 39a2e8e commit 158ee49
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/ts_close.c
Expand Up @@ -22,15 +22,19 @@ int ts_close(struct tsdev *ts)
{
void *handle;
int ret;
struct tslib_module_info *info, *prev;

for(info = ts->list, prev = info;
info != NULL;
info = prev->next, prev = info) {
struct tslib_module_info *info, *next;

info = ts->list;
while(info) {
/* Save the "next" pointer now because info will be freed */
next = info->next;

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

info = next;
}

ret = close(ts->fd);
Expand Down

0 comments on commit 158ee49

Please sign in to comment.