]> xenbits.xensource.com Git - libvirt.git/commit
src: Avoid needless checks before calling g_strdup()
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 18 Sep 2023 09:28:31 +0000 (11:28 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 18 Sep 2023 12:46:24 +0000 (14:46 +0200)
commit732c5f42704259b239f9533c31d43799054f184b
treec46fa7bd0dca0e3418a21364f8838f73d6fe3a8f
parent65558eb5cb11e1995f97e9d6f6d9ee977208a1b8
src: Avoid needless checks before calling g_strdup()

There are few places where the following pattern occurs:

  if (var)
      other = g_strdup(var);

where @other wasn't initialized before g_strdup(). Checking for
var != NULL is useless in this case, as that's exactly what
g_strdup() does (in which case it returns NULL).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_event.c
src/libxl/libxl_conf.c
src/lxc/lxc_native.c
src/qemu/qemu_monitor_json.c
src/util/virconf.c