File tree 12 files changed +2203
-2312
lines changed
12 files changed +2203
-2312
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1
1
#include < stdlib.h>
2
2
3
- int main ()
4
- {
5
- int *pi ;
6
- int i;
3
+ int main () {
4
+ int *pi ;
5
+ int i;
7
6
#ifdef DUMA_EXPLICIT_INIT
8
- duma_init ();
7
+ duma_init ();
9
8
#endif
10
- pi = (int *)malloc (10 * sizeof (int ));
11
- for (i= 0 ; i< 11 ; ++i)
12
- pi [i] = i; // this line should produce error with i == 10
13
- return 0 ;
9
+ pi = (int *)malloc (10 * sizeof (int ));
10
+ for (i = 0 ; i < 11 ; ++i)
11
+ pi [i] = i; // this line should produce error with i == 10
12
+ return 0 ;
14
13
}
Original file line number Diff line number Diff line change 1
1
#include < stdlib.h>
2
2
3
- int main ()
4
- {
5
- int *pi ;
6
- int i;
3
+ int main () {
4
+ int *pi ;
5
+ int i;
7
6
#ifdef DUMA_EXPLICIT_INIT
8
- duma_init ();
7
+ duma_init ();
9
8
#endif
10
- pi = (int *)malloc (10 * sizeof (int ));
11
- for (i= 0 ; i< 10 ; ++i)
12
- pi [i] = i;
13
- return 0 ;
14
- // pi is not freed
15
- // that should produce a memory leak
16
- // without information on allocation source without including duma.h
9
+ pi = (int *)malloc (10 * sizeof (int ));
10
+ for (i = 0 ; i < 10 ; ++i)
11
+ pi [i] = i;
12
+ return 0 ;
13
+ // pi is not freed
14
+ // that should produce a memory leak
15
+ // without information on allocation source without including duma.h
17
16
}
Original file line number Diff line number Diff line change 1
- #include < stdlib.h>
2
1
#include < duma.h>
2
+ #include < stdlib.h>
3
3
4
- int main ()
5
- {
6
- int *pi ;
7
- int i;
4
+ int main () {
5
+ int *pi ;
6
+ int i;
8
7
#ifdef DUMA_EXPLICIT_INIT
9
- duma_init ();
8
+ duma_init ();
10
9
#endif
11
- pi = (int *)malloc (10 * sizeof (int ));
12
- for (i= 0 ; i< 10 ; ++i)
13
- pi [i] = i;
14
- return 0 ;
15
- // pi is not freed
16
- // that should produce a memory leak
17
- // with information on allocation source - cause duma.h is included
10
+ pi = (int *)malloc (10 * sizeof (int ));
11
+ for (i = 0 ; i < 10 ; ++i)
12
+ pi [i] = i;
13
+ return 0 ;
14
+ // pi is not freed
15
+ // that should produce a memory leak
16
+ // with information on allocation source - cause duma.h is included
18
17
}
Original file line number Diff line number Diff line change 1
- #include < stdlib.h>
2
1
#include < duma.h>
2
+ #include < stdlib.h>
3
3
4
- int main ()
5
- {
6
- int *pi ;
7
- int i;
4
+ int main () {
5
+ int *pi ;
6
+ int i;
8
7
#ifdef DUMA_EXPLICIT_INIT
9
- duma_init ();
8
+ duma_init ();
10
9
#endif
11
- pi = (int *)malloc (10 *sizeof (int ));
12
- for (i=0 ; i<10 ; ++i)
13
- pi [i] = i;
14
- delete pi ; // this line should produce error, cause pi was allocated with malloc()
15
- return 0 ;
10
+ pi = (int *)malloc (10 * sizeof (int ));
11
+ for (i = 0 ; i < 10 ; ++i)
12
+ pi [i] = i;
13
+ delete pi ; // this line should produce error, cause pi was allocated with
14
+ // malloc()
15
+ return 0 ;
16
16
}
Original file line number Diff line number Diff line change 1
1
#include < dumapp.h>
2
2
3
- int main ()
4
- {
5
- int *pi ;
6
- int i;
3
+ int main () {
4
+ int *pi ;
5
+ int i;
7
6
#ifdef DUMA_EXPLICIT_INIT
8
- duma_init ();
7
+ duma_init ();
9
8
#endif
10
- pi = new int [10 ];
11
- for (i= 0 ; i< 10 ; ++i)
12
- pi [i] = i;
13
- delete [] pi ;
14
- return 0 ;
15
- // should run fine
9
+ pi = new int [10 ];
10
+ for (i = 0 ; i < 10 ; ++i)
11
+ pi [i] = i;
12
+ delete[] pi ;
13
+ return 0 ;
14
+ // should run fine
16
15
}
Original file line number Diff line number Diff line change 1
- int main ()
2
- {
3
- int *pi ;
4
- int i;
1
+ int main () {
2
+ int *pi ;
3
+ int i;
5
4
#ifdef DUMA_EXPLICIT_INIT
6
- duma_init ();
5
+ duma_init ();
7
6
#endif
8
- pi = new int [10 ];
9
- for (i= 0 ; i< 10 ; ++i)
10
- pi [i] = i;
11
- delete [] pi ;
12
- return 0 ;
13
- // should run fine
7
+ pi = new int [10 ];
8
+ for (i = 0 ; i < 10 ; ++i)
9
+ pi [i] = i;
10
+ delete[] pi ;
11
+ return 0 ;
12
+ // should run fine
14
13
}
Original file line number Diff line number Diff line change 1
- int main ()
2
- {
3
- int *pi ;
4
- int i;
1
+ int main () {
2
+ int *pi ;
3
+ int i;
5
4
#ifdef DUMA_EXPLICIT_INIT
6
- duma_init ();
5
+ duma_init ();
7
6
#endif
8
- pi = new int [10 ];
9
- for (i=0 ; i<10 ; ++i)
10
- pi [i] = i;
11
- delete pi ; // this line should produce error, cause pi was allocated with new[]()
12
- // unable to report allocation source - without including dumapp.h
13
- return 0 ;
7
+ pi = new int [10 ];
8
+ for (i = 0 ; i < 10 ; ++i)
9
+ pi [i] = i;
10
+ delete pi ; // this line should produce error, cause pi was allocated with
11
+ // new[]()
12
+ // unable to report allocation source - without including dumapp.h
13
+ return 0 ;
14
14
}
Original file line number Diff line number Diff line change 1
1
#include < dumapp.h>
2
2
3
- int main ()
4
- {
5
- int *pi ;
6
- int i;
3
+ int main () {
4
+ int *pi ;
5
+ int i;
7
6
#ifdef DUMA_EXPLICIT_INIT
8
- duma_init ();
7
+ duma_init ();
9
8
#endif
10
- pi = new int [10 ];
11
- for (i=0 ; i<10 ; ++i)
12
- pi [i] = i;
13
- delete pi ; // this line should produce error, cause pi was allocated with new[]()
14
- // allocation source should be reported, cause dumapp.h is included
15
- return 0 ;
9
+ pi = new int [10 ];
10
+ for (i = 0 ; i < 10 ; ++i)
11
+ pi [i] = i;
12
+ delete pi ; // this line should produce error, cause pi was allocated with
13
+ // new[]()
14
+ // allocation source should be reported, cause dumapp.h is included
15
+ return 0 ;
16
16
}
You can’t perform that action at this time.
0 commit comments