broadway: Fix memleak in error case

https://bugzilla.gnome.org/show_bug.cgi?id=751752
This commit is contained in:
Krzesimir Nowak 2015-06-30 22:55:59 +02:00 committed by Matthias Clasen
parent 15c73a2b1a
commit ef93c714f8

View File

@ -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)
{