migration: Use g_new() & friends where that makes obvious sense

g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
for two reasons.  One, it catches multiplication overflowing size_t.
Two, it returns T * rather than void *, which lets the compiler catch
more type errors.

This commit only touches allocations with size arguments of the form
sizeof(T).  Same Coccinelle semantic patch as in commit b45c03f.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1442231491-23352-1-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
7 files changed
tree: 73f29aa9a4099bf48ceb0708bd1706fe6852b04d
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. crypto/
  6. default-configs/
  7. disas/
  8. docs/
  9. fpu/
  10. fsdev/
  11. gdb-xml/
  12. hw/
  13. include/
  14. libdecnumber/
  15. linux-headers/
  16. linux-user/
  17. migration/
  18. net/
  19. pc-bios/
  20. po/
  21. qapi/
  22. qga/
  23. qobject/
  24. qom/
  25. roms/
  26. scripts/
  27. slirp/
  28. stubs/
  29. target-alpha/
  30. target-arm/
  31. target-cris/
  32. target-i386/
  33. target-lm32/
  34. target-m68k/
  35. target-microblaze/
  36. target-mips/
  37. target-moxie/
  38. target-openrisc/
  39. target-ppc/
  40. target-s390x/
  41. target-sh4/
  42. target-sparc/
  43. target-tilegx/
  44. target-tricore/
  45. target-unicore32/
  46. target-xtensa/
  47. tcg/
  48. tests/
  49. trace/
  50. ui/
  51. util/
  52. .exrc
  53. .gitignore
  54. .gitmodules
  55. .mailmap
  56. .travis.yml
  57. accel.c
  58. aio-posix.c
  59. aio-win32.c
  60. arch_init.c
  61. async.c
  62. balloon.c
  63. block.c
  64. blockdev-nbd.c
  65. blockdev.c
  66. blockjob.c
  67. bootdevice.c
  68. bt-host.c
  69. bt-vhci.c
  70. Changelog
  71. CODING_STYLE
  72. configure
  73. COPYING
  74. COPYING.LIB
  75. coroutine-gthread.c
  76. coroutine-sigaltstack.c
  77. coroutine-ucontext.c
  78. coroutine-win32.c
  79. cpu-exec-common.c
  80. cpu-exec.c
  81. cpus.c
  82. cputlb.c
  83. device-hotplug.c
  84. device_tree.c
  85. disas.c
  86. dma-helpers.c
  87. dump.c
  88. exec.c
  89. gdbstub.c
  90. HACKING
  91. hmp-commands-info.hx
  92. hmp-commands.hx
  93. hmp.c
  94. hmp.h
  95. iohandler.c
  96. ioport.c
  97. iothread.c
  98. kvm-all.c
  99. kvm-stub.c
  100. LICENSE
  101. main-loop.c
  102. MAINTAINERS
  103. Makefile
  104. Makefile.objs
  105. Makefile.target
  106. memory.c
  107. memory_mapping.c
  108. module-common.c
  109. monitor.c
  110. nbd.c
  111. numa.c
  112. os-posix.c
  113. os-win32.c
  114. page_cache.c
  115. qapi-schema.json
  116. qdev-monitor.c
  117. qdict-test-data.txt
  118. qemu-bridge-helper.c
  119. qemu-char.c
  120. qemu-coroutine-io.c
  121. qemu-coroutine-lock.c
  122. qemu-coroutine-sleep.c
  123. qemu-coroutine.c
  124. qemu-doc.texi
  125. qemu-ga.texi
  126. qemu-img-cmds.hx
  127. qemu-img.c
  128. qemu-img.texi
  129. qemu-io-cmds.c
  130. qemu-io.c
  131. qemu-log.c
  132. qemu-nbd.c
  133. qemu-nbd.texi
  134. qemu-options-wrapper.h
  135. qemu-options.h
  136. qemu-options.hx
  137. qemu-seccomp.c
  138. qemu-tech.texi
  139. qemu-timer.c
  140. qemu.nsi
  141. qemu.sasl
  142. qjson.c
  143. qmp-commands.hx
  144. qmp.c
  145. qtest.c
  146. README
  147. rules.mak
  148. softmmu_template.h
  149. spice-qemu-char.c
  150. tcg-runtime.c
  151. tci.c
  152. thread-pool.c
  153. thunk.c
  154. tpm.c
  155. trace-events
  156. translate-all.c
  157. translate-all.h
  158. translate-common.c
  159. user-exec.c
  160. VERSION
  161. version.rc
  162. vl.c
  163. xen-common-stub.c
  164. xen-common.c
  165. xen-hvm-stub.c
  166. xen-hvm.c
  167. xen-mapcache.c