Package: cppcheck
Version: 1.35-1
Severity: normal
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi
when running cppcheck over my code, I noticed that it erroneously marks
following code as resource leak:
void create_lock(const char *name, const void *lock_data, const size_t
lock_data_len)
{
FILE *fd;
fd = fopen(name, "w");
test_result(fd != NULL);
test_result(fwrite(lock_data, 1, lock_data_len, fd) == lock_data_len);
test_result(fclose(fd) == 0);
}
I get following error:
[gammu/tests/locking.c:21]: (error) Resource leak: fd
The test_result is just macro that checks if the result is and throws a
test error otherwise, so the fclose does happen every time.
- --
Michal Čihař | http://cihar.com | http://blog.cihar.com
- -- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core)
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages cppcheck depends on:
ii libc6 2.9-25 GNU C Library: Shared libraries
ii libgcc1 1:4.4.1-2 GCC support library
ii libstdc++6 4.4.1-2 The GNU Standard C++ Library v3
cppcheck recommends no packages.
cppcheck suggests no packages.
- -- no debconf information
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkqLrp8ACgkQ3DVS6DbnVgTjdACfU92WSlP2uncBBQ5hvYA0aaac
/ZoAoIIQg+ypimH2MUP16DMh7EK13UxV
=kmj2
-----END PGP SIGNATURE-----
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]