Revision: 48474
http://brlcad.svn.sourceforge.net/brlcad/?rev=48474&view=rev
Author: brlcad
Date: 2012-01-12 01:26:46 +0000 (Thu, 12 Jan 2012)
Log Message:
-----------
dereferencing the popped list value without actually checking if it's null
(although the loop iterator does this for us, so not technically an issue).
simplify the logic. should fix coverity REVERSE_INULL issue. (cov cid 1758)
Modified Paths:
--------------
brlcad/trunk/src/libbu/temp.c
Modified: brlcad/trunk/src/libbu/temp.c
===================================================================
--- brlcad/trunk/src/libbu/temp.c 2012-01-12 01:25:18 UTC (rev 48473)
+++ brlcad/trunk/src/libbu/temp.c 2012-01-12 01:26:46 UTC (rev 48474)
@@ -62,18 +62,24 @@
/* close all files, free their nodes, and unlink */
while (BU_LIST_WHILE(popped, temp_file_list, &(TF->l))) {
+ if (!popped)
+ break;
+
+ /* take it off the list */
BU_LIST_DEQUEUE(&(popped->l));
- if (popped) {
- if (popped->fd != -1) {
- close(popped->fd);
- popped->fd = -1;
- }
- if (BU_VLS_IS_INITIALIZED(&popped->fn) && bu_vls_addr(&popped->fn))
{
- bu_file_delete(bu_vls_addr(&popped->fn));
- bu_vls_free(&popped->fn);
- }
- bu_free(popped, "free bu_temp_file node");
+
+ /* close up shop */
+ if (popped->fd != -1) {
+ close(popped->fd);
+ popped->fd = -1;
}
+
+ /* burn the house down */
+ if (BU_VLS_IS_INITIALIZED(&popped->fn) && bu_vls_addr(&popped->fn)) {
+ bu_file_delete(bu_vls_addr(&popped->fn));
+ bu_vls_free(&popped->fn);
+ }
+ bu_free(popped, "free bu_temp_file node");
}
/* free the head */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits