aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base
diff options
context:
space:
mode:
authorLuis Machado <lgustavo@codesourcery.com>2013-11-27 10:39:26 -0200
committerLuis Machado <lgustavo@codesourcery.com>2013-11-27 10:39:26 -0200
commit0db4ca1856d6131e726434ff67cbe42a5e1f81d1 (patch)
tree584a25e62d26fe7a2a9fb97be38eb40c04c0563b /gdb/testsuite/gdb.base
parent48d5accb7a8b0b5195628b05e1f1dbf0c9cc4a22 (diff)
downloadgdb-0db4ca1856d6131e726434ff67cbe42a5e1f81d1.zip
gdb-0db4ca1856d6131e726434ff67cbe42a5e1f81d1.tar.gz
gdb-0db4ca1856d6131e726434ff67cbe42a5e1f81d1.tar.bz2
* gdb.base/callfuncs.c (main): Assign malloc's return value
and free it afterwards. * gdb.base/charset-malloc.c (malloc_stub): Likewise. * gdb.base/printcmds.c (main): Likewise. * gdb.base/randomize.c (main): Free "p" and change breakpoint marker position. * gdb.base/setvar.c (dummy): Assign malloc's return value and free it afterwards.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.c3
-rw-r--r--gdb/testsuite/gdb.base/charset-malloc.c3
-rw-r--r--gdb/testsuite/gdb.base/printcmds.c3
-rw-r--r--gdb/testsuite/gdb.base/randomize.c3
-rw-r--r--gdb/testsuite/gdb.base/setvar.c3
5 files changed, 10 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c
index 0d76ee9..c645e0a 100644
--- a/gdb/testsuite/gdb.base/callfuncs.c
+++ b/gdb/testsuite/gdb.base/callfuncs.c
@@ -652,9 +652,10 @@ voidfunc (void)
int main ()
{
- malloc(1);
+ void *p = malloc (1);
t_double_values(double_val1, double_val2);
t_structs_c(struct_val1);
+ free (p);
return 0 ;
}
diff --git a/gdb/testsuite/gdb.base/charset-malloc.c b/gdb/testsuite/gdb.base/charset-malloc.c
index 58242a2..565f872 100644
--- a/gdb/testsuite/gdb.base/charset-malloc.c
+++ b/gdb/testsuite/gdb.base/charset-malloc.c
@@ -31,5 +31,6 @@ malloc_stub (void)
{
/* charset.exp wants to allocate memory for constants. So make sure malloc
gets linked into the program. */
- malloc (1);
+ void *p = malloc (1);
+ free (p);
}
diff --git a/gdb/testsuite/gdb.base/printcmds.c b/gdb/testsuite/gdb.base/printcmds.c
index d80c13d..57e04e6 100644
--- a/gdb/testsuite/gdb.base/printcmds.c
+++ b/gdb/testsuite/gdb.base/printcmds.c
@@ -218,10 +218,11 @@ char invalid_RRR[] = "aaaaaaaaaaaaaaaaaaaa"
int main ()
{
- malloc(1);
+ void *p = malloc (1);
/* Prevent AIX linker from removing variables. */
return ctable1[0] + ctable2[0] + int1dim[0] + int2dim[0][0]
+ int3dim[0][0][0] + int4dim[0][0][0][0] + teststring[0] +
*parrays -> array1 + a1[0] + a2[0];
+ free (p);
}
diff --git a/gdb/testsuite/gdb.base/randomize.c b/gdb/testsuite/gdb.base/randomize.c
index 6a65663..4c91626 100644
--- a/gdb/testsuite/gdb.base/randomize.c
+++ b/gdb/testsuite/gdb.base/randomize.c
@@ -24,5 +24,6 @@ int main()
p = malloc (1);
- return 0; /* print p */
+ free (p); /* print p */
+ return 0;
}
diff --git a/gdb/testsuite/gdb.base/setvar.c b/gdb/testsuite/gdb.base/setvar.c
index 3a80b22..5d08602 100644
--- a/gdb/testsuite/gdb.base/setvar.c
+++ b/gdb/testsuite/gdb.base/setvar.c
@@ -204,7 +204,7 @@ dummy ()
{
/* setvar.exp wants to allocate memory for constants. So make sure malloc
gets linked into the program. */
- malloc (1);
+ void *p = malloc (1);
/* Some linkers (e.g. on AIX) remove unreferenced variables,
so make sure to reference them. */
@@ -278,4 +278,5 @@ dummy ()
sef.field = s1;
uef.field = u1;
#endif
+ free (p);
}