diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-06-25 14:19:25 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-06-25 14:19:25 +0000 |
commit | d89bc465ddef9e37a77a0bf8b6b95074303b5fad (patch) | |
tree | 813f5aec414e01261821ddfff1a88a47814d8425 | |
parent | 0b172c4b146b0ba50c4c7e17c77c4e2281dd179b (diff) | |
download | gpsd-d89bc465ddef9e37a77a0bf8b6b95074303b5fad.tar.gz |
Plugged a memory leak that I found with valgrind.
-rw-r--r-- | gpsd.c | 1 | ||||
-rw-r--r-- | gpsd.spec.in | 3 | ||||
-rwxr-xr-x | valgrind-audit | 2 | ||||
-rw-r--r-- | valgrind-suppressions | 19 |
4 files changed, 23 insertions, 2 deletions
@@ -888,6 +888,7 @@ static void handle_control(int sfd, char *buf) for (cfd = 0; cfd < FD_SETSIZE; cfd++) if (subscribers[cfd].device == *chp) subscribers[cfd].device = NULL; + gpsd_wrap(*chp); /*@i1@*/*chp = NULL; /* modifying observer storage */ (void)write(sfd, "OK\n", 3); } else diff --git a/gpsd.spec.in b/gpsd.spec.in index d51ebc25..45503db0 100644 --- a/gpsd.spec.in +++ b/gpsd.spec.in @@ -128,7 +128,8 @@ cp gps.py gpsfake.py "$RPM_BUILD_ROOT"%{_libdir}/python${PYVERSION}/site-package buffering problems with the Python side of the hotplug interface. gpsfake can now run sessions under a monitor like Valgrind. Most of the gpsfake logic now lives in a module that can be used to write - other test loads. Its progress prompt is now optional. + other test loads. Its progress prompt is now optional. Valgrind found + a memory leak in device deallocation. * Wed Jun 22 2005 Eric S. Raymond <esr@snark.thyrsus.com> - 2.26 - Time DOP and total DOP are now passed on from GPSes that report diff --git a/valgrind-audit b/valgrind-audit index f5cd56d6..dc9cbffd 100755 --- a/valgrind-audit +++ b/valgrind-audit @@ -4,7 +4,7 @@ # import gpsfake -invocation="valgrind --tool=memcheck --gen-suppressions=yes --suppressions=valgrind-suppressions" +invocation="valgrind --tool=memcheck --gen-suppressions=yes --leak-check=yes --suppressions=valgrind-suppressions" test = gpsfake.TestSession(prefix=invocation, options="-D 3") try: diff --git a/valgrind-suppressions b/valgrind-suppressions index 90be3a5f..d31a6098 100644 --- a/valgrind-suppressions +++ b/valgrind-suppressions @@ -1,3 +1,22 @@ # Suppress known C library errors in valgrind. # This is good under gcc 3.4.2, glibc 2.3.4, using -g and -O2 +{ + suppress1 + Memcheck:Cond + fun:strlen + fun:vsnprintf + fun:gpsd_report + fun:main +} +{ + suppress2 + Memcheck:Value8 + fun:vfprintf + fun:vsnprintf + fun:gpsd_report + fun:sirf_parse + fun:sirfbin_parse_input + fun:gpsd_poll + fun:main +} |