[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-cvs
Subject:    [Ltp-cvs] ltp/lib parse_opts.c,1.4,1.5
From:       robbiew () users ! sourceforge ! net
Date:       2004-01-05 20:07:14
Message-ID: E1Adb0M-0008H5-00 () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/ltp/ltp/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv31680

Modified Files:
	parse_opts.c 
Log Message:
Applied patch from Randy Hron:
==============================
valgrind shows a memory leak in parse_opts.c when running alarm01:

valgrind --leak-check=yes  --show-reachable=yes ./alarm01
==13861==
alarm01     1  PASS  :  alarm(1) returned 0
==13861==
==13861== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13861== malloc/free: in use at exit: 14 bytes in 1 blocks.
==13861== malloc/free: 1 allocs, 0 frees, 14 bytes allocated.
==13861== For counts of detected errors, rerun with: -v
==13861== searching for pointers to 1 not-freed blocks.
==13861== checked 3622444 bytes.
==13861==
==13861== 14 bytes in 1 blocks are definitely lost in loss record 1 of 1
==13861==    at 0x400289B9: malloc (in /usr/local/lib/valgrind/vgskin_memcheck.so)
==13861==    by 0x8048F0D: (within \
/usr/src/sources/l/ltp-full-20031204/testcases/kernel/syscalls/alarm/alarm01) \
==13861==    by 0x402627C6: __libc_start_main (in /lib/libc-2.3.2.so) ==13861==    by \
0x8048BA0: (within /usr/src/sources/l/ltp-full-20031204/testcases/kernel/syscalls/alarm/alarm01)
 ==13861==
==13861== LEAK SUMMARY:
==13861==    definitely lost: 14 bytes in 1 blocks.
==13861==    possibly lost:   0 bytes in 0 blocks.
==13861==    still reachable: 0 bytes in 0 blocks.
==13861==         suppressed: 0 bytes in 0 blocks.
==13861==

This fixes the memory leak.

--- ltp-full-20031204/lib/parse_opts.c.orig		 2000-09-06 10:33:29.000000000 -0400
+++ ltp-full-20031204/lib/parse_opts.c		 2004-01-02 17:21:49.823868616 -0500
@@ -326,6 +326,7 @@
 		 }
 
     }    /* end of while */
+    free(optionstr);
 
     STD_argind = optind;
 

-- 
Randy Hron
==============================


Index: parse_opts.c
===================================================================
RCS file: /cvsroot/ltp/ltp/lib/parse_opts.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- parse_opts.c	6 Sep 2000 14:33:29 -0000	1.4
+++ parse_opts.c	5 Jan 2004 20:07:12 -0000	1.5
@@ -324,6 +324,7 @@
                 return(Mesg2);
             }
 	}
+	free(optionstr);
 
     }    /* end of while */
 




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Ltp-cvs mailing list
Ltp-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic