qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
Subject: [Qemu-devel] [PULL 01/23] use g_path_get_dirname instead of dirname
Date: Mon, 18 Jul 2016 11:27:33 +0200	[thread overview]
Message-ID: <1468834075-25669-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1468834075-25669-1-git-send-email-pbonzini@redhat.com>

From: Wei Jiangang <weijg.fnst@cn.fujitsu.com>

Use g_path_get_basename to get the directory components of
a file name, and free its return when no longer needed.

Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
Message-Id: <1459997185-15669-3-git-send-email-weijg.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 os-posix.c         | 3 ++-
 util/oslib-posix.c | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/os-posix.c b/os-posix.c
index 3755265..c6ddb7d 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -89,7 +89,7 @@ char *os_find_datadir(void)
     if (exec_dir == NULL) {
         return NULL;
     }
-    dir = dirname(exec_dir);
+    dir = g_path_get_dirname(exec_dir);
 
     max_len = strlen(dir) +
         MAX(strlen(SHARE_SUFFIX), strlen(BUILD_SUFFIX)) + 1;
@@ -103,6 +103,7 @@ char *os_find_datadir(void)
         }
     }
 
+    g_free(dir);
     g_free(exec_dir);
     return res;
 }
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index d8e5dcf..6d70d9a 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -299,9 +299,11 @@ void qemu_init_exec_dir(const char *argv0)
             return;
         }
     }
-    dir = dirname(p);
+    dir = g_path_get_dirname(p);
 
     pstrcpy(exec_dir, sizeof(exec_dir), dir);
+
+    g_free(dir);
 }
 
 char *qemu_get_exec_dir(void)
-- 
2.7.4

  reply	other threads:[~2016-07-18  9:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18  9:27 [Qemu-devel] [PULL 00/23] TCG and misc patches for 2.7 hard freeze from 2016-07-18 Paolo Bonzini
2016-07-18  9:27 ` Paolo Bonzini [this message]
2016-07-18  9:27 ` [Qemu-devel] [PULL 02/23] Changed malloc to g_malloc, free to g_free in bsd-user/qemu.h Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 03/23] hw/i386: add device tree support Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 04/23] compiler: never omit assertions if using a static analysis tool Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 05/23] megasas: remove useless check for cmd->frame Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 06/23] checkpatch: consider git extended headers valid patches Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 07/23] exec: avoid realloc in phys_map_node_reserve Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 08/23] cpu-exec: Move down some declarations in cpu_exec() Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 09/23] util/qht: Document memory ordering assumptions Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 10/23] tcg: Pass last_tb by value to tb_find_fast() Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 11/23] tcg: Prepare safe tb_jmp_cache lookup out of tb_lock Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 12/23] tcg: Prepare safe access to tb_flushed " Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 13/23] target-i386: Remove redundant HF_SOFTMMU_MASK Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 14/23] tcg: Introduce tb_mark_invalid() and tb_is_invalid() Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 15/23] tcg: Prepare TB invalidation for lockless TB lookup Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 16/23] tcg: set up tb->page_addr before insertion Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 17/23] tcg: cpu-exec: remove tb_lock from the hot-path Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 18/23] tcg: Avoid bouncing tb_lock between tb_gen_code() and tb_add_jump() Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 19/23] tcg: Merge tb_find_slow() and tb_find_fast() Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 20/23] tcg: rename tb_find_physical() Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 21/23] Move README to markdown Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 22/23] block/iscsi: fix rounding in iscsi_allocationmap_set Paolo Bonzini
2016-07-18  9:27 ` [Qemu-devel] [PULL 23/23] block/iscsi: allow caching of the allocation map Paolo Bonzini
2016-07-18 11:51 ` [Qemu-devel] [PULL 00/23] TCG and misc patches for 2.7 hard freeze from 2016-07-18 Peter Maydell
2016-07-18 11:54   ` Paolo Bonzini
2016-07-18 11:57     ` Peter Maydell
2016-07-18 11:59       ` Paolo Bonzini
2016-07-18 12:50         ` Peter Maydell
2016-07-18 13:22           ` Paolo Bonzini
2016-07-18 13:41             ` Peter Maydell
2016-07-18 13:59               ` Paolo Bonzini

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=1468834075-25669-2-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weijg.fnst@cn.fujitsu.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).