Print this page
11506 smatch resync
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/validation/sm_memory.c
+++ new/usr/src/tools/smatch/src/validation/sm_memory.c
1 1 void *kmalloc(void);
2 2 void free(void *);
3 3
4 4 struct ture {
5 5 int *a;
6 6 };
7 7
8 8 struct ture *a;
9 9 struct ture *b;
10 10 void func (void)
11 11 {
12 12 struct ture *aa;
13 13 struct ture *ab;
14 14 struct ture *ac;
15 15 aa = kmalloc();
16 16 ab = kmalloc();
17 17 ac = kmalloc();
18 18
19 19 a = aa;
20 20 if (ab) {
21 21 free(ab);
22 22 return;
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
23 23 }
24 24 free(ac);
25 25 return;
26 26 }
27 27 /*
28 28 * check-name: leak test #1
29 29 * check-command: smatch sm_memory.c
30 30 *
31 31 * check-output-start
32 32 sm_memory.c:22 func() warn: possible memory leak of 'ac'
33 -sm_memory.c:22 func() error: memory leak of 'ac'
34 33 * check-output-end
35 34 */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX