Skip to content

Commit 100dde9

Browse files
committed
fsm-listen-darwin: Free CoreFoundation paths
They are not freed even though they should be. Signed-off-by: Greg Funni <[email protected]>
1 parent c4a0c88 commit 100dde9

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

compat/fsmonitor/fsm-darwin-gcc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ unsigned char FSEventStreamStart(FSEventStreamRef stream);
8585
void FSEventStreamStop(FSEventStreamRef stream);
8686
void FSEventStreamInvalidate(FSEventStreamRef stream);
8787
void FSEventStreamRelease(FSEventStreamRef stream);
88+
void CFRelease(CFStringRef cf);
8889

8990
#endif /* !clang */
9091
#endif /* FSM_DARWIN_GCC_H */

compat/fsmonitor/fsm-listen-darwin.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,13 @@ int fsm_listen__ctor(struct fsmonitor_daemon_state *state)
455455
failed:
456456
error(_("Unable to create FSEventStream."));
457457

458+
if (data->cfar_paths_to_watch)
459+
CFRelease(data->cfar_paths_to_watch);
460+
if (data->cfsr_gitdir_path)
461+
CFRelease(data->cfsr_gitdir_path);
462+
if (data->cfsr_worktree_path)
463+
CFRelease(data->cfsr_worktree_path);
464+
458465
FREE_AND_NULL(state->listen_data);
459466
return -1;
460467
}
@@ -476,6 +483,13 @@ void fsm_listen__dtor(struct fsmonitor_daemon_state *state)
476483
FSEventStreamRelease(data->stream);
477484
}
478485

486+
if (data->cfar_paths_to_watch)
487+
CFRelease(data->cfar_paths_to_watch);
488+
if (data->cfsr_gitdir_path)
489+
CFRelease(data->cfsr_gitdir_path);
490+
if (data->cfsr_worktree_path)
491+
CFRelease(data->cfsr_worktree_path);
492+
479493
if (data->dq)
480494
dispatch_release(data->dq);
481495
pthread_cond_destroy(&data->dq_finished);

0 commit comments

Comments
 (0)