Check-in [9cf62b20d5]
Overview
Comment:Updated leakcheck to require a filename as parameter
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9cf62b20d51974351ef99904f594e45d95a7b4ed
User & Date: rkeene on 2010-05-15 00:56:39
Other Links: manifest | tags
Context
2010-05-17
00:20
Fixed issues with signdecrypt buffer sizes

Centralized reading of identities

Added debugging to determine why wrong applet ID is being stored in identity check-in: eaa9f36a2b user: rkeene tags: trunk

2010-05-15
00:56
Updated leakcheck to require a filename as parameter check-in: 9cf62b20d5 user: rkeene tags: trunk
00:50
Further documentation for the leakcheck tool check-in: a87e5cb815 user: rkeene tags: trunk
Changes

Modified leakcheck/leakcheck from [ebd6df1f69] to [eea3ae5a09].

1
2

3

4







5

6
7
8
9
10
11
12
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21


+

+

+
+
+
+
+
+
+
-
+







#! /bin/bash

LEAKCHECKFILE="$1"
TMPFILE="${TMPDIR:-/tmp}/malloc-free-check-$$${RANDOM}${RANDOM}${RANDOM}.tmp"
export LEAKCHECKFILE TMPFILE

if [ -z "${LEAKCHECKFILE}" ]; then
	echo "Usage: leakcheck <filename>" >&2
	echo "         filename       Name of file containing debugging output" >&2

	exit 1
fi

egrep '(MALLOC|FREE|REALLOC)' "$@" | sed 's@^.*FREE(\(0x[0-9a-f]*\)).*$@free \1@;s@^.*MALLOC() = @malloc @;s@^.*REALLOC(\(0x[0-9a-f]*\)) = @realloc \1 @' > "${TMPFILE}"
egrep '(MALLOC|FREE|REALLOC)' "${LEAKCHECKFILE}" | sed 's@^.*FREE(\(0x[0-9a-f]*\)).*$@free \1@;s@^.*MALLOC() = @malloc @;s@^.*REALLOC(\(0x[0-9a-f]*\)) = @realloc \1 @' > "${TMPFILE}"

cat "${TMPFILE}" | while read op addr newaddr; do
	case "${op}" in
		malloc)
			if [ -z "${alloclist}" ]; then
				alloclist="${addr}"
			else
34
35
36
37
38
39
40
41

42
43
44
45
46

47
48
49
50
51
52
53
43
44
45
46
47
48
49

50
51
52
53
54

55
56
57
58
59
60
61
62







-
+




-
+







done | tail -1 | while read leftovers; do
	for leftover in ${leftovers}; do
		case "${leftover}" in
			!*)
				leftover="$(echo "${leftover}" | cut -c 2-)"

				echo "Double freed or never allocated ${leftover}:"
				grep "${leftover}" "$@" | sed 's@^@    @'
				grep "${leftover}" "${LEAKCHECKFILE}" | sed 's@^@    @'
				echo ''
				;;
			*)
				echo "Unfreed memory ${leftover}:"
				grep "${leftover}" "$@" | sed 's@^@    @'
				grep "${leftover}" "${LEAKCHECKFILE}" | sed 's@^@    @'
				echo ''
				;;
		esac
	done
done

rm -f "${TMPFILE}"