Skip to content

Commit

Permalink
Merge pull request #74 from Leo1003/fix_memory_leaks
Browse files Browse the repository at this point in the history
Fix memory leaks
  • Loading branch information
implausible authored Jun 11, 2019
2 parents b82fcc1 + 2818e9e commit cb017fc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/linux/InotifyEventLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ void InotifyEventLoop::work() {
}

if (isDirectoryEvent) {
inotifyService->createDirectory(event->wd, strdup(event->name));
inotifyService->createDirectory(event->wd, event->name);
} else {
inotifyService->create(event->wd, strdup(event->name));
inotifyService->create(event->wd, event->name);
}
};

Expand All @@ -49,7 +49,7 @@ void InotifyEventLoop::work() {
return;
}

inotifyService->modify(event->wd, strdup(event->name));
inotifyService->modify(event->wd, event->name);
};

auto remove = [&event, &isDirectoryRemoval, &inotifyService]() {
Expand All @@ -60,7 +60,7 @@ void InotifyEventLoop::work() {
if (isDirectoryRemoval) {
inotifyService->removeDirectory(event->wd);
} else {
inotifyService->remove(event->wd, strdup(event->name));
inotifyService->remove(event->wd, event->name);
}
};

Expand Down Expand Up @@ -133,7 +133,7 @@ void InotifyEventLoop::work() {

renameStart();
} else if (event->mask & (uint32_t)IN_MOVE_SELF) {
inotifyService->remove(event->wd, strdup(event->name));
inotifyService->remove(event->wd, event->name);
inotifyService->removeDirectory(event->wd);
}
} while((position += sizeof(struct inotify_event) + event->len) < bytesRead);
Expand Down

0 comments on commit cb017fc

Please sign in to comment.