Skip to content

Commit cb017fc

Browse files
authored
Merge pull request #74 from Leo1003/fix_memory_leaks
Fix memory leaks
2 parents b82fcc1 + 2818e9e commit cb017fc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/linux/InotifyEventLoop.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ void InotifyEventLoop::work() {
3838
}
3939

4040
if (isDirectoryEvent) {
41-
inotifyService->createDirectory(event->wd, strdup(event->name));
41+
inotifyService->createDirectory(event->wd, event->name);
4242
} else {
43-
inotifyService->create(event->wd, strdup(event->name));
43+
inotifyService->create(event->wd, event->name);
4444
}
4545
};
4646

@@ -49,7 +49,7 @@ void InotifyEventLoop::work() {
4949
return;
5050
}
5151

52-
inotifyService->modify(event->wd, strdup(event->name));
52+
inotifyService->modify(event->wd, event->name);
5353
};
5454

5555
auto remove = [&event, &isDirectoryRemoval, &inotifyService]() {
@@ -60,7 +60,7 @@ void InotifyEventLoop::work() {
6060
if (isDirectoryRemoval) {
6161
inotifyService->removeDirectory(event->wd);
6262
} else {
63-
inotifyService->remove(event->wd, strdup(event->name));
63+
inotifyService->remove(event->wd, event->name);
6464
}
6565
};
6666

@@ -133,7 +133,7 @@ void InotifyEventLoop::work() {
133133

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

0 commit comments

Comments
 (0)