diff options
Diffstat (limited to 'unix-socket.c')
-rw-r--r-- | unix-socket.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/unix-socket.c b/unix-socket.c index 79800d8063..9a21ade5d8 100644 --- a/unix-socket.c +++ b/unix-socket.c @@ -63,8 +63,10 @@ static int unix_sockaddr_init(struct sockaddr_un *sa, const char *path, if (strbuf_getcwd(&cwd)) return -1; ctx->orig_dir = strbuf_detach(&cwd, NULL); - if (chdir_len(dir, slash - dir) < 0) + if (chdir_len(dir, slash - dir) < 0) { + FREE_AND_NULL(ctx->orig_dir); return -1; + } } memset(sa, 0, sizeof(*sa)); |