]> git.draconx.ca Git - gentoo-draconx.git/blob - x11-libs/libxcb/files/0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch
Add xorg-x11 ebuild without nonfree fonts.
[gentoo-draconx.git] / x11-libs / libxcb / files / 0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch
1 From 2272f6421cabc916fabae78faad568b1c96af618 Mon Sep 17 00:00:00 2001
2 From: Nick Bowler <nbowler@elliptictech.com>
3 Date: Wed, 10 Nov 2010 10:11:36 -0500
4 Subject: [PATCH] xcb_auth: Fix memory leak in _xcb_get_auth_info.
5
6 If the initial get_peer_sock_name(getpeername ...) succeeds, the
7 pointer to allocated memory is overwritten by the later call to
8 get_peer_sock_name(getsockname ...).  Fix that up by freeing
9 the allocated memory before overwriting the pointer.
10
11 Signed-off-by: Nick Bowler <nbowler@draconx.ca>
12 ---
13  src/xcb_auth.c |   11 ++++++++---
14  1 files changed, 8 insertions(+), 3 deletions(-)
15
16 diff --git a/src/xcb_auth.c b/src/xcb_auth.c
17 index 1af27fc..4839b78 100644
18 --- a/src/xcb_auth.c
19 +++ b/src/xcb_auth.c
20 @@ -327,10 +327,15 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
21      if (!info->namelen)
22          goto no_auth;   /* out of memory */
23  
24 -    if (!gotsockname && (sockname = get_peer_sock_name(getsockname, fd)) == NULL)
25 +    if (!gotsockname)
26      {
27 -        free(info->name);
28 -        goto no_auth;   /* can only authenticate sockets */
29 +        free(sockname);
30 +
31 +        if ((sockname = get_peer_sock_name(getsockname, fd)) == NULL)
32 +        {
33 +            free(info->name);
34 +            goto no_auth;   /* can only authenticate sockets */
35 +        }
36      }
37  
38      ret = compute_auth(info, authptr, sockname);
39 -- 
40 1.7.2.2
41