All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Obermayr <johannesobermayr@gmx.de>
To: dri-devel@lists.freedesktop.org
Cc: Johannes Obermayr <johannesobermayr@gmx.de>
Subject: [PATCH 4/5] xf86drm.c: Make more code UDEV unrelevant and fix a memory leak.
Date: Fri, 13 Jul 2012 17:49:16 +0200	[thread overview]
Message-ID: <1342194557-4144-5-git-send-email-johannesobermayr@gmx.de> (raw)
In-Reply-To: <1342194557-4144-1-git-send-email-johannesobermayr@gmx.de>

---
 xf86drm.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index 6ea068f..e3789c8 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -255,6 +255,7 @@ static int drmMatchBusID(const char *id1, const char *id2, int pci_domain_ok)
     return 0;
 }
 
+#if !defined(UDEV)
 /**
  * Handles error checking for chown call.
  *
@@ -284,6 +285,7 @@ static int chown_check_return(const char *path, uid_t owner, gid_t group)
 			path, errno, strerror(errno));
 	return -1;
 }
+#endif
 
 /**
  * Open the DRM device, creating it if necessary.
@@ -303,14 +305,17 @@ static int drmOpenDevice(long dev, int minor, int type)
     stat_t          st;
     char            buf[64];
     int             fd;
+#if !defined(UDEV)
     mode_t          devmode = DRM_DEV_MODE, serv_mode;
     int             isroot  = !geteuid();
     uid_t           user    = DRM_DEV_UID;
     gid_t           group   = DRM_DEV_GID, serv_group;
-    
+#endif
+
     sprintf(buf, type ? DRM_DEV_NAME : DRM_CONTROL_DEV_NAME, DRM_DIR_NAME, minor);
     drmMsg("drmOpenDevice: node name is %s\n", buf);
 
+#if !defined(UDEV)
     if (drm_server_info) {
 	drm_server_info->get_perms(&serv_group, &serv_mode);
 	devmode  = serv_mode ? serv_mode : DRM_DEV_MODE;
@@ -318,7 +323,6 @@ static int drmOpenDevice(long dev, int minor, int type)
 	group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
     }
 
-#if !defined(UDEV)
     if (stat(DRM_DIR_NAME, &st)) {
 	if (!isroot)
 	    return DRM_ERR_NOT_ROOT;
@@ -1395,8 +1399,10 @@ drm_context_t *drmGetReservedContextList(int fd, int *count)
     }
 
     res.contexts = list;
-    if (drmIoctl(fd, DRM_IOCTL_RES_CTX, &res))
+    if (drmIoctl(fd, DRM_IOCTL_RES_CTX, &res)) {
+	drmFree(retval);
 	return NULL;
+    }
 
     for (i = 0; i < res.count; i++)
 	retval[i] = list[i].handle;
-- 
1.7.7

  parent reply	other threads:[~2012-07-13 15:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-13 15:49 libdrm: Fix some warnings reported by clang's scan-build tool Johannes Obermayr
2012-07-13 15:49 ` [PATCH 1/5] libkms/intel.c: Fix a memory leak and a dead assignment as well as cleanup code a bit Johannes Obermayr
2012-07-13 15:49 ` [PATCH 2/5] libkms/nouveau.c: Fix a memory leak and " Johannes Obermayr
2012-07-13 15:49 ` [PATCH 3/5] nouveau/nouveau.c: Fix two memory leaks Johannes Obermayr
2012-07-13 15:49 ` Johannes Obermayr [this message]
2012-07-13 15:49 ` [PATCH 5/5] modetest.c: Add return 0 in bit_name_fn(res) macro Johannes Obermayr
2012-07-13 16:47 ` libdrm: Fix some warnings reported by clang's scan-build tool Marcin Slusarz
2012-07-13 18:34   ` libdrm: Fix some warnings reported by clang's scan-build tool [try 2] Johannes Obermayr
2012-07-13 18:34     ` [PATCH 1/6] libkms/intel.c: Fix a memory leak and a dead assignment as well as make some code easier to read Johannes Obermayr
2012-07-13 18:34     ` [PATCH 2/6] libkms/nouveau.c: Fix a memory leak and " Johannes Obermayr
2012-07-13 18:34     ` [PATCH 3/6] nouveau/nouveau.c: Fix two memory leaks Johannes Obermayr
2012-07-13 18:34     ` [PATCH 4/6] xf86drm.c: Make more code UDEV unrelevant Johannes Obermayr
2012-07-13 18:34     ` [PATCH 5/6] xf86drm.c: Fix two memory leaks Johannes Obermayr
2012-07-13 18:34     ` [PATCH 6/6] modetest.c: Add return 0 in bit_name_fn(res) macro Johannes Obermayr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342194557-4144-5-git-send-email-johannesobermayr@gmx.de \
    --to=johannesobermayr@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.