* gdb.base/callfuncs.c (main): Assign malloc's return value
authorLuis Machado <lgustavo@codesourcery.com>
Wed, 27 Nov 2013 12:39:26 +0000 (10:39 -0200)
committerLuis Machado <lgustavo@codesourcery.com>
Wed, 27 Nov 2013 12:39:26 +0000 (10:39 -0200)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/callfuncs.c
gdb/testsuite/gdb.base/charset-malloc.c
gdb/testsuite/gdb.base/printcmds.c
gdb/testsuite/gdb.base/randomize.c
gdb/testsuite/gdb.base/setvar.c

index 618d67258e74603dee10153c5e66b9fb7e05f092..a778544810c84b25632e9b50a3e8d2b1ced9d2e8 100644 (file)
@@ -1,3 +1,14 @@
+2013-11-26  Luis Machado  <lgustavo@codesourcery.com>
+
+       * 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.
+
 2013-11-26  Andrew Burgess  <aburgess@broadcom.com>
 
        * gdb.base/setshow.exp: Add $gdb_prompt to the patterns in
index 0d76ee93e2b99f4decbf2d6f7021154f5096a230..c645e0ac435d447acaad89e4ff64b5666bf2e26a 100644 (file)
@@ -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 ;
 }
 
index 58242a20957197d3028bc5438c29929332117b19..565f872a27306149b02f7e487b6eab7a7e83fb35 100644 (file)
@@ -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);
 }
index d80c13d95af7c0979b4496071f3c2c4273854bc7..57e04e6c01f3765523588e1f21045561d9742222 100644 (file)
@@ -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);
 }
index 6a6566342a7942b601ab854267f9aae2f2c520c0..4c91626260fb38db52a6aa7047369ad26047c86f 100644 (file)
@@ -24,5 +24,6 @@ int main()
 
   p = malloc (1);
 
-  return 0; /* print p */
+  free (p); /* print p */
+  return 0;
 }
index 3a80b227c99a23941c32ed2398808396afede941..5d086029395e13088cc656c7d8462059b0f7a3d9 100644 (file)
@@ -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);
 }
This page took 0.045253 seconds and 4 git commands to generate.