Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jun 2015 08:38:56 -0400
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-pkg@freebsd.org
Subject:   Re: Problems found by infer
Message-ID:  <557AD2E0.8030303@FreeBSD.org>
In-Reply-To: <557A5309.40304@highsecure.ru>
References:  <557A5309.40304@highsecure.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 11/06/2015 23:33, Vsevolod Stakhov wrote:
> libpkg/pkg_printf.c:2883: error: MEMORY_LEAK
>    memory dynamically allocated by call to sbuf_new() at line 2880,
> column 41 is not reachable after line 2883, column 3
> 
> libpkg/pkg_printf.c:2928: error: MEMORY_LEAK
>    memory dynamically allocated by call to sbuf_new() at line 2925,
> column 41 is not reachable after line 2928, column 3
> 
> libpkg/pkg_printf.c:2977: error: MEMORY_LEAK
>    memory dynamically allocated by call to sbuf_new() at line 2974,
> column 41 is not reachable after line 2977, column 3
> 
> libpkg/pkg_printf.c:3031: error: MEMORY_LEAK
>    memory dynamically allocated by call to sbuf_new() at line 3028,
> column 41 is not reachable after line 3031, column 3
> 
> libpkg/pkg_printf.c:3083: error: MEMORY_LEAK
>    memory dynamically allocated by call to sbuf_new() at line 3080,
> column 41 is not reachable after line 3083, column 3

These seem to be mostly a stylistic thing caused by this sort of code
pattern:

   ptr = malloc(size);
   ptr = do_something(ptr, arg1, arg2);

where 'do_something()' will either return the ptr unchanged or pass it
to free() and return NULL.

Dunno if there's a way to tell infer that's how those functions behave.

	Cheers,

	Matthew



[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.20 (Darwin)

iQJ8BAEBCgBmBQJVetLzXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NTNBNjhCOTEzQTRFNkNGM0UxRTEzMjZC
QjIzQUY1MThFMUE0MDEzAAoJELsjr1GOGkATytYQAKO/V+ctnmqzjNq4HxL8bJ9v
jnEZxDiz01JE7ACgkQafGWryie+2l30Cm1DQVkyz7yz4IEjMkR69o73egub7F/gh
BmX5Y28D8LDQOz6exSQ3HudGF+xL9ZyYpz/TchKR/UeHYtE1mPlPjGXEe0wY6GDT
qIv3l8uZtrwYSM6i27H4mAoxb5ePtwSBwmVjLLbanjl6Eaj60EjNgasZzc1VPA2g
kcTI17X40ySReFVz0qGofz5tdfUr+yZMksIO/i2mEqgteDmwRqUfS8yIptpZ1WxV
F3EdwM9v2tlnSEFZIPwuqOt2GmovBT6OweIrTWvU7I8DarMjShhGjnW932xZZML3
fOmsJCEqc/DWr+S8LECeZefGU0bwwJ7uxPkpFL2wUBMtmhyU4SxpJISEV0zGwg28
LtkJaJ6Gmjr60lJ7aDDhan3g3ZmDdLOx6xNUzkhxDxQy2hcaP6lg9AWZMtRfzFWy
c30h0vHgnn4INi/9sOf1rR6+Fi9C5NOBQzkeSXlUgF5cV5t1yiY5WYTCWw2/TeQ3
AJ6wBeW0jmiqoXSdIvMu8pNgx56an4mPVIYJLrjh+s/hwVBZD7mo7mJgjxcXWr9V
AoFZFBudWtpRq3/2eAN4lwaOcGOtvDmPFI/fAFaJeOquR9VuF0BZ4tk+KBMyCtHj
ifyojM+p5ErUKbrgisdi
=Gy96
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?557AD2E0.8030303>