Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/flingfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,27 @@ flingfd_t *flingfd_open(const char *path) {
goto error;

handle = (flingfd_t *)malloc(sizeof(flingfd_t));
if (!handle)
goto error;

handle->fd = fd;
handle->path = path_copy;
handle->is_bound = false;
if (!handle) {
int errsv = errno;

return handle;
if (fd != -1)
close(fd);

error:;
int errsv = errno;
free(path_copy);
free(handle);

if (fd != -1)
close(fd);
errno = errsv;

free(path_copy);
free(handle);
return NULL;
}
else {

errno = errsv;
handle->fd = fd;
handle->path = path_copy;
handle->is_bound = false;

return NULL;
return handle;
}
}

int flingfd_send(flingfd_t *handle, int fd) {
Expand Down