diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2010-10-20 22:39:21 +0200 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2010-11-24 19:12:10 -0500 |
commit | 70b8d2ab93dde22408723811748219d0bff16c73 (patch) | |
tree | dc666fa807226f4574bcd2c597cf601daee3273f /sys | |
parent | 225bc1dd0b5d8a0a4d859865ef25ad0762ee3eff (diff) |
shm: Fix socket leak on connect() error
Diffstat (limited to 'sys')
-rw-r--r-- | sys/shm/shmpipe.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/shm/shmpipe.c b/sys/shm/shmpipe.c index f9728de3f..1952d5b52 100644 --- a/sys/shm/shmpipe.c +++ b/sys/shm/shmpipe.c @@ -710,10 +710,8 @@ sp_client_open (const char *path) memset (self, 0, sizeof (ShmPipe)); self->main_socket = socket (PF_UNIX, SOCK_STREAM, 0); - if (self->main_socket < 0) { - sp_close (self); - return NULL; - } + if (self->main_socket < 0) + goto error; sun.sun_family = AF_UNIX; strncpy (sun.sun_path, path, sizeof (sun.sun_path) - 1); @@ -725,7 +723,7 @@ sp_client_open (const char *path) return self; error: - spalloc_free (ShmPipe, self); + sp_close (self); return NULL; } |