~bkerensa/ubuntu/raring/valgrind/merge-from-deb

« back to all changes in this revision

Viewing changes to exp-omega/tests/block3.c

  • Committer: Bazaar Package Importer
  • Author(s): Andrés Roldán
  • Date: 2008-06-13 02:31:40 UTC
  • mto: (1.4.1 upstream) (2.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: james.westby@ubuntu.com-20080613023140-iwk33rz9rhvfkr96
Import upstream version 3.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdlib.h>
 
2
 
 
3
typedef struct
 
4
{
 
5
  char *spointer1;
 
6
} structure;
 
7
 
 
8
structure **func1(void)
 
9
{
 
10
 
 
11
  structure **pointer1 = 0;
 
12
 
 
13
  pointer1 = (structure **)malloc(4 * sizeof(structure *)); /* Line 13 */
 
14
  pointer1[1] = (structure *)malloc(sizeof(structure));     /* Line 14 */
 
15
  pointer1[1]->spointer1 = (char *)malloc(64);              /* Line 15 */
 
16
 
 
17
  return pointer1;
 
18
}
 
19
 
 
20
int main(int argc, char *argv[])
 
21
{
 
22
  structure **pointer1 = func1();
 
23
 
 
24
  free(pointer1);         /* Leak reports Line 24 */
 
25
 
 
26
  return 0;
 
27
}