coverity: Fix g_malloc_n-like models

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVB/9UAAoJEDhwtADrkYZTI8kP/Az1xs69cnMh1cZP/ug4TBC3
 OEPPPdcSJqPaJwxW6PGhEKW2X1RuwVXluVF6jnMcXzLil6QRbnIOE0iG7YjN5q5c
 AwDuZHbj3UjkFXmSPKsp/f1/GFkMaE6FmZkkhWucAJkb6lkW3SORUA/e1T7gpSUx
 FbAxXL9L2A0+JP3QihDms4ck+sIsZ5GU6GgWKztcQYib93zlIfqn6dCejS3IbJHe
 satPgzyr9B7JE12BOXhj4LFQpcF0mCJ6+eCDHiFA6XIdH+2SsBlj5rcjZPl757nd
 R7SqPFXsaVU2CBEo5VLbI4r0axHqS0Wz0KG7x83LJCu1KlpeqCWllbPJl3tB3EQh
 QKJuYl6yKAPm6J9vvkoBp/QJu3OZf+fUVNKjoSrThBZLhypx1YkXUaUO209krhTl
 wKyEac/JSPQNm2TKdKtboYvvb86VU1r+V+5uWXqQ6hyPcymu4WQiNUSxnS45lVsN
 7BOiCHb7Gc1YnYBKx9q3S9FJwMbbLhCsuiejLaRTDT8ZtSqSITDODG7Tlf4bdCKC
 wgz4tCs0vqNl2K+tI0JYSzcMuHyUZINPlLDfiMrXJY6HYDzz67SRayIUjIBL2eBj
 pQ1eG0f/dM4l/ZYbTrO8Ts7Uz3/socvx9FJ7QpYq/sGW5HQgHZ0e05jERn6PhwQf
 HW+6EwhUUluIL5z7qxUs
 =+0u5
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-cov-model-2015-03-17' into staging

coverity: Fix g_malloc_n-like models

# gpg: Signature made Tue Mar 17 10:17:56 2015 GMT using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-cov-model-2015-03-17:
  coverity: Fix g_malloc_n-like models

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-03-17 11:43:00 +00:00
commit 5a4992834d

View File

@ -123,7 +123,7 @@ void *g_malloc_n(size_t nmemb, size_t size)
__coverity_negative_sink__(nmemb);
__coverity_negative_sink__(size);
sz = nmemb * size;
ptr = __coverity_alloc__(size);
ptr = __coverity_alloc__(sz);
__coverity_mark_as_uninitialized_buffer__(ptr);
__coverity_mark_as_afm_allocated__(ptr, "g_free");
return ptr;
@ -137,7 +137,7 @@ void *g_malloc0_n(size_t nmemb, size_t size)
__coverity_negative_sink__(nmemb);
__coverity_negative_sink__(size);
sz = nmemb * size;
ptr = __coverity_alloc__(size);
ptr = __coverity_alloc__(sz);
__coverity_writeall0__(ptr);
__coverity_mark_as_afm_allocated__(ptr, "g_free");
return ptr;
@ -151,7 +151,7 @@ void *g_realloc_n(void *ptr, size_t nmemb, size_t size)
__coverity_negative_sink__(size);
sz = nmemb * size;
__coverity_escape__(ptr);
ptr = __coverity_alloc__(size);
ptr = __coverity_alloc__(sz);
/*
* Memory beyond the old size isn't actually initialized. Can't
* model that. See Coverity's realloc() model