diff mbox series

core/qdev: fix memleak in qdev_get_gpio_out_connector()

Message ID 20200307030756.5913-1-pannengyuan@huawei.com (mailing list archive)
State New, archived
Headers show
Series core/qdev: fix memleak in qdev_get_gpio_out_connector() | expand

Commit Message

Pan Nengyuan March 7, 2020, 3:07 a.m. UTC
Fix a memory leak in qdev_get_gpio_out_connector().

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
 hw/core/qdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

no-reply@patchew.org March 7, 2020, 3:16 a.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20200307030756.5913-1-pannengyuan@huawei.com/



Hi,

This series failed the docker-clang@ubuntu build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-ubuntu V=1 NETWORK=1
time make docker-test-clang@ubuntu SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

  GEN     hppa-softmmu/hmp-commands.h
  GEN     alpha-softmmu/hmp-commands.h
  GEN     microblazeel-softmmu/hmp-commands-info.h
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  GEN     microblazeel-softmmu/config-devices.h
  GEN     lm32-softmmu/hmp-commands-info.h
  GEN     microblazeel-softmmu/config-target.h
---
  GEN     i386-softmmu/config-devices.h
  GEN     i386-softmmu/config-target.h
  CC      i386-softmmu/exec.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  GEN     arm-softmmu/hmp-commands-info.h
  GEN     arm-softmmu/config-devices.h
  GEN     arm-softmmu/config-target.h
---
  CC      mips-softmmu/qapi/qapi-introspect.o
  CC      mips-softmmu/qapi/qapi-types-machine-target.o
  CC      mips-softmmu/qapi/qapi-types-misc-target.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      i386-softmmu/hw/i386/multiboot.o
  CC      mips64el-softmmu/hw/mips/gt64xxx_pci.o
  CC      hppa-softmmu/qapi/qapi-types-machine-target.o
---
  CC      moxie-softmmu/trace/control-target.o
  CC      or1k-softmmu/qapi/qapi-introspect.o
  CC      aarch64-softmmu/target/arm/monitor.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      ppc64-softmmu/memory_mapping.o
  CC      arm-softmmu/target/arm/arm-powerctl.o
  CC      nios2-softmmu/target/nios2/translate.o
---
  GEN     aarch64-softmmu/target/arm/decode-vfp-uncond.inc.c
  GEN     aarch64-softmmu/target/arm/decode-a32.inc.c
  GEN     aarch64-softmmu/target/arm/decode-a32-uncond.inc.c
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  GEN     aarch64-softmmu/target/arm/decode-t32.inc.c
  CC      ppc-softmmu/accel/stubs/kvm-stub.o
  CC      nios2-softmmu/target/nios2/cpu.o
---
  GEN     aarch64-softmmu/target/arm/decode-sve.inc.c
  CC      ppc-softmmu/hw/block/virtio-blk.o
  CC      ppc64-softmmu/hw/block/dataplane/virtio-blk.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  GEN     or1k-softmmu/target/openrisc/decode.inc.c
  CC      arm-softmmu/softmmu/main.o
  CC      or1k-softmmu/target/openrisc/exception_helper.o
---
  GEN     trace/generated-helpers.c
  CC      ppc64-softmmu/hw/display/virtio-gpu-3d.o
  CC      aarch64-softmmu/softmmu/main.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      or1k-softmmu/trace/control-target.o
  CC      aarch64-softmmu/gdbstub-xml.o
  CC      ppc64-softmmu/hw/display/vhost-user-gpu.o
---
  CC      ppc64-softmmu/hw/net/spapr_llan.o
  CC      ppc64-softmmu/hw/net/xilinx_ethlite.o
  CC      ppc64-softmmu/hw/net/virtio-net.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      riscv32-softmmu/tcg/optimize.o
  CC      ppc-softmmu/hw/scsi/vhost-scsi.o
  CC      ppc-softmmu/hw/scsi/vhost-user-scsi.o
---
  CC      sh4eb-softmmu/hw/virtio/vhost-user-blk-pci.o
  LINK    unicore32-softmmu/qemu-system-unicore32
  CC      s390x-softmmu/hw/virtio/vhost.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      ppc64-softmmu/hw/ppc/ppc4xx_pci.o
  CC      sh4-softmmu/hw/virtio/virtio-iommu-pci.o
  CC      sh4eb-softmmu/hw/virtio/vhost-user-input-pci.o
---
  CC      sh4-softmmu/hw/sh4/shix.o
  CC      sparc64-softmmu/hw/virtio/virtio-input-host-pci.o
  CC      riscv64-softmmu/hw/riscv/riscv_htif.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      sh4eb-softmmu/hw/virtio/virtio-scsi-pci.o
  CC      sh4eb-softmmu/hw/virtio/virtio-blk-pci.o
  CC      sparc-softmmu/softmmu/main.o
---
  GEN     riscv32-softmmu/target/riscv/decode_insn16.inc.c
  CC      riscv32-softmmu/target/riscv/op_helper.o
  CC      sh4-softmmu/qapi/qapi-commands.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  LINK    ppc-softmmu/qemu-system-ppc
  CC      sh4eb-softmmu/qapi/qapi-types.o
  CC      sh4eb-softmmu/qapi/qapi-visit-machine-target.o
---
  CC      s390x-softmmu/hw/s390x/3270-ccw.o
  CC      ppc64-softmmu/target/ppc/arch_dump.o
  CC      riscv64-softmmu/target/riscv/gdbstub.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      ppc64-softmmu/target/ppc/mmu-hash64.o
  CC      ppc64-softmmu/target/ppc/mmu-book3s-v3.o
  CC      sparc64-softmmu/target/sparc/ldst_helper.o
---
  CC      sparc64-softmmu/target/sparc/vis_helper.o
  CC      s390x-softmmu/hw/s390x/virtio-ccw.o
  CC      s390x-softmmu/hw/s390x/virtio-ccw-serial.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      ppc64-softmmu/target/ppc/compat.o
  CC      sparc64-softmmu/target/sparc/gdbstub.o
  GEN     trace/generated-helpers.c
  CC      sparc64-softmmu/trace/control-target.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  GEN     xtensa-softmmu/hmp-commands.h
  GEN     xtensaeb-softmmu/hmp-commands.h
  CC      ppc64-softmmu/target/ppc/mmu-radix64.o
  GEN     xtensaeb-softmmu/hmp-commands-info.h
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  GEN     xtensaeb-softmmu/config-devices.h
  GEN     xtensa-softmmu/hmp-commands-info.h
  GEN     xtensaeb-softmmu/config-target.h
---
  CC      s390x-softmmu/hw/s390x/virtio-ccw-gpu.o
  CC      riscv64-softmmu/trace/generated-helpers.o
  CC      ppc64-softmmu/target/ppc/../../libdecnumber/dpd/decimal32.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      ppc64-softmmu/target/ppc/../../libdecnumber/dpd/decimal64.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      ppc64-softmmu/target/ppc/../../libdecnumber/dpd/decimal128.o
  LINK    riscv64-softmmu/qemu-system-riscv64
  CC      s390x-softmmu/hw/s390x/virtio-ccw-input.o
---
  CC      ppc64-softmmu/softmmu/main.o
  CC      s390x-softmmu/hw/s390x/virtio-ccw-net.o
  CC      xtensaeb-softmmu/tcg/tcg-op-gvec.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      ppc64-softmmu/gdbstub-xml.o
  CC      x86_64-softmmu/accel/tcg/cpu-exec-common.o
  CC      x86_64-softmmu/accel/tcg/translate-all.o
---
  CC      aarch64-linux-user/target/arm/translate-a64.o
  CC      xtensa-softmmu/hw/virtio/virtio-balloon-pci.o
  CC      hppa-linux-user/target/hppa/helper.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      arm-linux-user/linux-user/flatload.o
  CC      xtensaeb-softmmu/hw/virtio/vhost-scsi-pci.o
  CC      cris-linux-user/linux-user/fd-trans.o
---
  CC      x86_64-softmmu/qapi/qapi-introspect.o
  CC      m68k-linux-user/tcg/tcg-op.o
  CC      microblaze-linux-user/tcg/tcg-common.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      xtensaeb-softmmu/target/xtensa/monitor.o
  CC      mips-linux-user/tcg/tcg-op-gvec.o
  CC      microblaze-linux-user/tcg/optimize.o
---
  CC      m68k-linux-user/linux-user/strace.o
  CC      mips-linux-user/linux-user/signal.o
  CC      mips64el-linux-user/tcg/optimize.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      m68k-linux-user/linux-user/mmap.o
  CC      x86_64-softmmu/target/i386/excp_helper.o
  CC      microblazeel-linux-user/linux-user/main.o
---
  CC      i386-linux-user/target/i386/helper.o
  CC      m68k-linux-user/linux-user/signal.o
  CC      i386-linux-user/target/i386/cpu.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      mips-linux-user/linux-user/elfload.o
  CC      mips-linux-user/linux-user/linuxload.o
  CC      mips-linux-user/linux-user/uaccess.o
---
  LINK    xtensa-linux-user/qemu-xtensa
  LINK    xtensaeb-linux-user/qemu-xtensaeb
  LINK    x86_64-linux-user/qemu-x86_64
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
rm tests/qemu-iotests/socket_scm_helper.o
make[1]: Entering directory '/tmp/qemu-test/src/slirp'
make[1]: Nothing to be done for 'all'.
---
  CC      f128_add.o
  CC      f128_sub.o
  CC      f128_mul.o
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  CC      f128_mulAdd.o
  CC      f128_div.o
  CC      f128_rem.o
---
  CC      s_propagateNaNF128UI.o
  LINK    tests/test-throttle
  AR      libtestfloat.a
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  AR      libsoftfloat.a
  LINK    tests/test-thread-pool
  LINK    tests/test-hbitmap
  LINK    tests/test-bdrv-drain
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  LINK    fp-test
  LINK    tests/test-bdrv-graph-mod
  LINK    tests/test-blockjob
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  LINK    tests/test-blockjob-txn
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  LINK    tests/test-block-backend
  LINK    tests/test-block-iothread
  LINK    tests/test-image-locking
  LINK    tests/test-x86-cpuid
  LINK    tests/test-xbzrle
  LINK    tests/test-vmstate
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  LINK    tests/test-cutils
  LINK    tests/test-shift128
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  LINK    tests/test-mul64
  LINK    tests/test-int128
  LINK    tests/rcutorture
---
  LINK    tests/test-crypto-hash
  LINK    tests/test-crypto-hmac
  LINK    tests/test-crypto-cipher
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  LINK    tests/test-crypto-secret
  LINK    tests/test-crypto-tlscredsx509
  LINK    tests/test-crypto-tlssession
---
  FLOAT TEST lt_quiet
  FLOAT TEST add
  FLOAT TEST sub
/usr/bin/ld: /lib/x86_64-linux-gnu/libtirpc.so.3: warning: common of `rpc_createerr@@GLIBC_2.2.5' overridden by definition from /lib/x86_64-linux-gnu/libc.so.6
  FLOAT TEST uint-to-float
  FLOAT TEST float-to-int
  FLOAT TEST mul
---
dbus-daemon[8098]: Could not get password database information for UID of current process: User "???" unknown or no memory to allocate password entry

**
ERROR:/tmp/qemu-test/src/tests/qtest/dbus-vmstate-test.c:114:get_connection: assertion failed (err == NULL): The connection is closed (g-io-error-quark, 18)
ERROR - Bail out! ERROR:/tmp/qemu-test/src/tests/qtest/dbus-vmstate-test.c:114:get_connection: assertion failed (err == NULL): The connection is closed (g-io-error-quark, 18)
Aborted (core dumped)
cleaning up pid 8098
make: *** [/tmp/qemu-test/src/tests/Makefile.include:632: check-qtest-i386] Error 1
make: *** Waiting for unfinished jobs....

Looking for expected file 'tests/data/acpi/pc/FACP.cphp'
---
dbus-daemon[9481]: Could not get password database information for UID of current process: User "???" unknown or no memory to allocate password entry

**
ERROR:/tmp/qemu-test/src/tests/qtest/dbus-vmstate-test.c:114:get_connection: assertion failed (err == NULL): The connection is closed (g-io-error-quark, 18)
cleaning up pid 9481
Aborted (core dumped)
ERROR - Bail out! ERROR:/tmp/qemu-test/src/tests/qtest/dbus-vmstate-test.c:114:get_connection: assertion failed (err == NULL): The connection is closed (g-io-error-quark, 18)
make: *** [/tmp/qemu-test/src/tests/Makefile.include:632: check-qtest-x86_64] Error 1
  TEST    check-qtest-arm: tests/qtest/test-hmp
  TEST    check-qtest-arm: tests/qtest/qos-test
  TEST    check-qtest-aarch64: tests/qtest/test-hmp
---
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=41579675a5f04b46a380d31527c6a6a2', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-fna4ur7_/src/docker-src.2020-03-06-21.58.02.28164:/var/tmp/qemu:z,ro', 'qemu:ubuntu', '/var/tmp/qemu/run', 'test-clang']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=41579675a5f04b46a380d31527c6a6a2
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-fna4ur7_/src'
make: *** [docker-run-test-clang@ubuntu] Error 2

real    18m22.536s
user    0m9.374s


The full log is available at
http://patchew.org/logs/20200307030756.5913-1-pannengyuan@huawei.com/testing.docker-clang@ubuntu/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Marc-André Lureau March 7, 2020, 10:39 a.m. UTC | #2
Hi

On Sat, Mar 7, 2020 at 3:53 AM Pan Nengyuan <pannengyuan@huawei.com> wrote:
>
> Fix a memory leak in qdev_get_gpio_out_connector().
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>

good catch,
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  hw/core/qdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 3937d1eb1a..85f062def7 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -557,7 +557,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
>
>  qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
>  {
> -    char *propname = g_strdup_printf("%s[%d]",
> +    g_autofree char *propname = g_strdup_printf("%s[%d]",
>                                       name ? name : "unnamed-gpio-out", n);
>
>      qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,
> --
> 2.18.2
>
>
Laurent Vivier March 9, 2020, 9:16 a.m. UTC | #3
Le 07/03/2020 à 11:39, Marc-André Lureau a écrit :
> Hi
> 
> On Sat, Mar 7, 2020 at 3:53 AM Pan Nengyuan <pannengyuan@huawei.com> wrote:
>>
>> Fix a memory leak in qdev_get_gpio_out_connector().
>>
>> Reported-by: Euler Robot <euler.robot@huawei.com>
>> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> 
> good catch,
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

trivial question:

Why do we prefer g_autofree() to the g_free() function?

Thanks,
Laurent

>> ---
>>  hw/core/qdev.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>> index 3937d1eb1a..85f062def7 100644
>> --- a/hw/core/qdev.c
>> +++ b/hw/core/qdev.c
>> @@ -557,7 +557,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
>>
>>  qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
>>  {
>> -    char *propname = g_strdup_printf("%s[%d]",
>> +    g_autofree char *propname = g_strdup_printf("%s[%d]",
>>                                       name ? name : "unnamed-gpio-out", n);
>>
>>      qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,
>> --
>> 2.18.2
>>
>>
> 
>
Pan Nengyuan March 9, 2020, 10:41 a.m. UTC | #4
On 3/9/2020 5:16 PM, Laurent Vivier wrote:
> Le 07/03/2020 à 11:39, Marc-André Lureau a écrit :
>> Hi
>>
>> On Sat, Mar 7, 2020 at 3:53 AM Pan Nengyuan <pannengyuan@huawei.com> wrote:
>>>
>>> Fix a memory leak in qdev_get_gpio_out_connector().
>>>
>>> Reported-by: Euler Robot <euler.robot@huawei.com>
>>> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
>>
>> good catch,
>> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> trivial question:
> 
> Why do we prefer g_autofree() to the g_free() function?

Honestly, it's no special reason in this case, just personal preference. :)
Both of them is ok.

Thanks.

> 
> Thanks,
> Laurent
> 
>>> ---
>>>  hw/core/qdev.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>>> index 3937d1eb1a..85f062def7 100644
>>> --- a/hw/core/qdev.c
>>> +++ b/hw/core/qdev.c
>>> @@ -557,7 +557,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
>>>
>>>  qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
>>>  {
>>> -    char *propname = g_strdup_printf("%s[%d]",
>>> +    g_autofree char *propname = g_strdup_printf("%s[%d]",
>>>                                       name ? name : "unnamed-gpio-out", n);
>>>
>>>      qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,
>>> --
>>> 2.18.2
>>>
>>>
>>
>>
>
Daniel P. Berrangé March 9, 2020, 10:48 a.m. UTC | #5
On Mon, Mar 09, 2020 at 10:16:28AM +0100, Laurent Vivier wrote:
> Le 07/03/2020 à 11:39, Marc-André Lureau a écrit :
> > Hi
> > 
> > On Sat, Mar 7, 2020 at 3:53 AM Pan Nengyuan <pannengyuan@huawei.com> wrote:
> >>
> >> Fix a memory leak in qdev_get_gpio_out_connector().
> >>
> >> Reported-by: Euler Robot <euler.robot@huawei.com>
> >> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> > 
> > good catch,
> > Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> trivial question:
> 
> Why do we prefer g_autofree() to the g_free() function?

The g_autofree annotation guarantees that g_free() gets invoked
when the variable goes out of scope, in all code paths.

This avoids the need to do the classic "goto cleanup;" jumps
with manuall free calls. So as well as simplifying code it
makes it less error prone in general. Of course the method
in this patch is only three lines long so you don't really
see the benefits, but there's also no real harm. So I'd
personally always pick g_autofree in situations where it
is usable, as it is a good habit to be in when you get to
more complex codepaths.

> >> ---
> >>  hw/core/qdev.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> >> index 3937d1eb1a..85f062def7 100644
> >> --- a/hw/core/qdev.c
> >> +++ b/hw/core/qdev.c
> >> @@ -557,7 +557,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
> >>
> >>  qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
> >>  {
> >> -    char *propname = g_strdup_printf("%s[%d]",
> >> +    g_autofree char *propname = g_strdup_printf("%s[%d]",
> >>                                       name ? name : "unnamed-gpio-out", n);
> >>
> >>      qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,
> >> --

Regards,
Daniel
Laurent Vivier March 9, 2020, 10:49 a.m. UTC | #6
Le 09/03/2020 à 11:41, Pan Nengyuan a écrit :
> 
> 
> On 3/9/2020 5:16 PM, Laurent Vivier wrote:
>> Le 07/03/2020 à 11:39, Marc-André Lureau a écrit :
>>> Hi
>>>
>>> On Sat, Mar 7, 2020 at 3:53 AM Pan Nengyuan <pannengyuan@huawei.com> wrote:
>>>>
>>>> Fix a memory leak in qdev_get_gpio_out_connector().
>>>>
>>>> Reported-by: Euler Robot <euler.robot@huawei.com>
>>>> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
>>>
>>> good catch,
>>> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> trivial question:
>>
>> Why do we prefer g_autofree() to the g_free() function?
> 
> Honestly, it's no special reason in this case, just personal preference. :)
> Both of them is ok.

I asked because the function above uses a g_free() for the same purpose.

Thanks,
Laurent
Laurent Vivier March 9, 2020, 12:05 p.m. UTC | #7
Le 07/03/2020 à 04:07, Pan Nengyuan a écrit :
> Fix a memory leak in qdev_get_gpio_out_connector().
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> ---
>  hw/core/qdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 3937d1eb1a..85f062def7 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -557,7 +557,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
>  
>  qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
>  {
> -    char *propname = g_strdup_printf("%s[%d]",
> +    g_autofree char *propname = g_strdup_printf("%s[%d]",
>                                       name ? name : "unnamed-gpio-out", n);
>  
>      qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,
> 

Applied to my trivial-patches branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 3937d1eb1a..85f062def7 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -557,7 +557,7 @@  void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
 
 qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
 {
-    char *propname = g_strdup_printf("%s[%d]",
+    g_autofree char *propname = g_strdup_printf("%s[%d]",
                                      name ? name : "unnamed-gpio-out", n);
 
     qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,