Commit ef93c714 authored by Krzesimir Nowak's avatar Krzesimir Nowak Committed by Matthias Clasen

broadway: Fix memleak in error case

https://bugzilla.gnome.org/show_bug.cgi?id=751752
parent 15c73a2b
......@@ -827,7 +827,7 @@ map_named_shm (char *name, gsize size)
void *ptr;
char *filename = NULL;
fd = shm_open(name, O_RDONLY, 0600);
fd = shm_open (name, O_RDONLY, 0600);
if (fd == -1)
{
filename = g_build_filename (g_get_tmp_dir (), name, NULL);
......@@ -835,13 +835,15 @@ map_named_shm (char *name, gsize size)
if (fd == -1)
{
perror ("Failed to map shm");
g_free (filename);
return NULL;
}
}
ptr = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
ptr = mmap (0, size, PROT_READ, MAP_SHARED, fd, 0);
(void) close(fd);
(void) close (fd);
if (filename)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment