tests/cris: Fix some errors and potential crashes

These errors were reported by cppcheck:

tests/cris/check_openpf1.c:30: error:
Mismatching allocation and deallocation: f

tests/cris/check_openpf2.c:13: error:
Mismatching allocation and deallocation: f

tests/cris/check_stat3.c:16: error:
Buffer overrun possible for long cmd-line args

tests/cris/check_stat4.c:18: error:
Buffer overrun possible for long cmd-line args

The first two are obvious coding errors (fopen needs fclose, not close).

The last two may seem less important (nobody will start test code
with an argument of more than 1022 characters which raises a buffer
overrun). Fixing them nevertheless helps with static code checks
like those done by cppcheck.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
4 files changed
tree: e37790dd76f7d53761522dea178296251db90501
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. libcacard/
  12. linux-user/
  13. net/
  14. pc-bios/
  15. QMP/
  16. roms/
  17. scripts/
  18. slirp/
  19. sysconfigs/
  20. target-alpha/
  21. target-arm/
  22. target-cris/
  23. target-i386/
  24. target-lm32/
  25. target-m68k/
  26. target-microblaze/
  27. target-mips/
  28. target-ppc/
  29. target-s390x/
  30. target-sh4/
  31. target-sparc/
  32. tcg/
  33. tests/
  34. ui/
  35. .gitignore
  36. .gitmodules
  37. a.out.h
  38. acl.c
  39. acl.h
  40. aes.c
  41. aes.h
  42. aio.c
  43. alpha-dis.c
  44. alpha.ld
  45. arch_init.c
  46. arch_init.h
  47. arm-dis.c
  48. arm-semi.c
  49. arm.ld
  50. async.c
  51. balloon.c
  52. balloon.h
  53. bitmap.c
  54. bitmap.h
  55. bitops.c
  56. bitops.h
  57. block-migration.c
  58. block-migration.h
  59. block.c
  60. block.h
  61. block_int.h
  62. blockdev.c
  63. blockdev.h
  64. bswap.h
  65. bt-host.c
  66. bt-host.h
  67. bt-vhci.c
  68. buffered_file.c
  69. buffered_file.h
  70. cache-utils.c
  71. cache-utils.h
  72. Changelog
  73. check-qdict.c
  74. check-qfloat.c
  75. check-qint.c
  76. check-qjson.c
  77. check-qlist.c
  78. check-qstring.c
  79. cmd.c
  80. cmd.h
  81. CODING_STYLE
  82. compatfd.c
  83. compatfd.h
  84. config.h
  85. configure
  86. console.c
  87. console.h
  88. COPYING
  89. COPYING.LIB
  90. cpu-all.h
  91. cpu-common.h
  92. cpu-defs.h
  93. cpu-exec.c
  94. cpus.c
  95. cpus.h
  96. cris-dis.c
  97. cursor.c
  98. cursor_hidden.xpm
  99. cursor_left_ptr.xpm
  100. cutils.c
  101. def-helper.h
  102. device_tree.c
  103. device_tree.h
  104. dis-asm.h
  105. disas.c
  106. disas.h
  107. dma-helpers.c
  108. dma.h
  109. dyngen-exec.h
  110. elf.h
  111. envlist.c
  112. envlist.h
  113. exec-all.h
  114. exec.c
  115. gdbstub.c
  116. gdbstub.h
  117. gen-icount.h
  118. HACKING
  119. hmp-commands.hx
  120. host-utils.c
  121. host-utils.h
  122. hpet.h
  123. hppa-dis.c
  124. hppa.ld
  125. i386-dis.c
  126. i386.ld
  127. ia64-dis.c
  128. ia64.ld
  129. input.c
  130. iohandler.c
  131. ioport-user.c
  132. ioport.c
  133. ioport.h
  134. iorange.h
  135. iov.c
  136. iov.h
  137. json-lexer.c
  138. json-lexer.h
  139. json-parser.c
  140. json-parser.h
  141. json-streamer.c
  142. json-streamer.h
  143. kvm-all.c
  144. kvm-stub.c
  145. kvm.h
  146. libfdt_env.h
  147. LICENSE
  148. linux-aio.c
  149. m68k-dis.c
  150. m68k-semi.c
  151. m68k.ld
  152. MAINTAINERS
  153. Makefile
  154. Makefile.dis
  155. Makefile.hw
  156. Makefile.objs
  157. Makefile.target
  158. Makefile.user
  159. microblaze-dis.c
  160. migration-exec.c
  161. migration-fd.c
  162. migration-tcp.c
  163. migration-unix.c
  164. migration.c
  165. migration.h
  166. mips-dis.c
  167. mips.ld
  168. module.c
  169. module.h
  170. monitor.c
  171. monitor.h
  172. nbd.c
  173. nbd.h
  174. net-checksum.c
  175. net.c
  176. net.h
  177. notify.c
  178. notify.h
  179. os-posix.c
  180. os-win32.c
  181. osdep.c
  182. osdep.h
  183. oslib-posix.c
  184. oslib-win32.c
  185. path.c
  186. pci-ids.txt
  187. pflib.c
  188. pflib.h
  189. poison.h
  190. posix-aio-compat.c
  191. ppc-dis.c
  192. ppc.ld
  193. ppc64.ld
  194. qbool.c
  195. qbool.h
  196. qdict-test-data.txt
  197. qdict.c
  198. qdict.h
  199. qemu-aio.h
  200. qemu-barrier.h
  201. qemu-char.c
  202. qemu-char.h
  203. qemu-common.h
  204. qemu-config.c
  205. qemu-config.h
  206. qemu-doc.texi
  207. qemu-error.c
  208. qemu-error.h
  209. qemu-img-cmds.hx
  210. qemu-img.c
  211. qemu-img.texi
  212. qemu-io.c
  213. qemu-lock.h
  214. qemu-log.h
  215. qemu-malloc.c
  216. qemu-nbd.c
  217. qemu-nbd.texi
  218. qemu-objects.h
  219. qemu-option.c
  220. qemu-option.h
  221. qemu-options.h
  222. qemu-options.hx
  223. qemu-os-posix.h
  224. qemu-os-win32.h
  225. qemu-queue.h
  226. qemu-sockets.c
  227. qemu-tech.texi
  228. qemu-thread-posix.c
  229. qemu-thread-posix.h
  230. qemu-thread-win32.c
  231. qemu-thread-win32.h
  232. qemu-thread.h
  233. qemu-timer-common.c
  234. qemu-timer.c
  235. qemu-timer.h
  236. qemu-tool.c
  237. qemu-x509.h
  238. qemu.sasl
  239. qemu_socket.h
  240. qerror.c
  241. qerror.h
  242. qfloat.c
  243. qfloat.h
  244. qint.c
  245. qint.h
  246. qjson.c
  247. qjson.h
  248. qlist.c
  249. qlist.h
  250. qmp-commands.hx
  251. qobject.h
  252. qstring.c
  253. qstring.h
  254. range.h
  255. readline.c
  256. readline.h
  257. README
  258. rules.mak
  259. rwhandler.c
  260. rwhandler.h
  261. s390-dis.c
  262. s390.ld
  263. savevm.c
  264. sh4-dis.c
  265. simpletrace.c
  266. simpletrace.h
  267. softmmu-semi.h
  268. softmmu_defs.h
  269. softmmu_exec.h
  270. softmmu_header.h
  271. softmmu_template.h
  272. sparc-dis.c
  273. sparc.ld
  274. sparc64.ld
  275. spice-qemu-char.c
  276. sysemu.h
  277. targphys.h
  278. tcg-runtime.c
  279. thunk.c
  280. thunk.h
  281. TODO
  282. trace-events
  283. translate-all.c
  284. uboot_image.h
  285. usb-bsd.c
  286. usb-linux.c
  287. usb-stub.c
  288. VERSION
  289. version.rc
  290. vgafont.h
  291. vl.c
  292. x86_64.ld