[PVFS2-CVS] commit by neill in pvfs2/src/client/sysint: sys-remove.sm

CVS commit program cvs at parl.clemson.edu
Fri May 7 14:21:35 EDT 2004


Update of /projects/cvsroot/pvfs2/src/client/sysint
In directory parlweb:/tmp/cvs-serv13165/src/client/sysint

Modified Files:
	sys-remove.sm 
Log Message:
- check if we need to free the msgarray in a few more places


Index: sys-remove.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-remove.sm,v
diff -p -u -r1.60 -r1.61
--- sys-remove.sm	6 May 2004 20:45:47 -0000	1.60
+++ sys-remove.sm	7 May 2004 17:21:35 -0000	1.61
@@ -387,7 +387,10 @@ static int remove_getattr_setup_msgpair(
         js_p->error_code = ret;
     }
 
-    /* let 'msgpairarray' handle the 'msgpair' case */
+    if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
+    {
+        free(sm_p->msgarray);
+    }
     sm_p->msgarray = &(sm_p->msgpair);
     sm_p->msgarray_count = 1;
     
@@ -504,7 +507,10 @@ static int remove_rmdirent_setup_msgpair
 	js_p->error_code = ret;
     }
 
-    /* let 'msgpairarray' handle the 'msgpair' case */
+    if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
+    {
+        free(sm_p->msgarray);
+    }
     sm_p->msgarray = &(sm_p->msgpair);
     sm_p->msgarray_count = 1;
 
@@ -576,7 +582,10 @@ static int remove_crdirent_setup_msgpair
         js_p->error_code = ret;
     }
 
-    /* let 'msgpairarray' handle the 'msgpair' case */
+    if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
+    {
+        free(sm_p->msgarray);
+    }
     sm_p->msgarray = &(sm_p->msgpair);
     sm_p->msgarray_count = 1;
 
@@ -670,7 +679,10 @@ static int remove_check_dir_contents_set
 	js_p->error_code = ret;
     }
 
-    /* let 'msgpairarray' handle the 'msgpair' case */
+    if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
+    {
+        free(sm_p->msgarray);
+    }
     sm_p->msgarray = msg_p;
     sm_p->msgarray_count = 1;
 
@@ -766,13 +778,10 @@ static int remove_object_remove_setup_ms
 	js_p->error_code = ret;
     }
 
-    /* in the single message case (formerly msgpair), msgarray points to the
-     * single statically allocated msgpair member.  so free only if dynamically
-     * allocated */
-    if (sm_p->msgarray != &(sm_p->msgpair) )
-	free (sm_p->msgarray);
-
-    /* let 'msgpairarray' handle the 'msgpair' case */
+    if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
+    {
+        free(sm_p->msgarray);
+    }
     sm_p->msgarray = &(sm_p->msgpair);
     sm_p->msgarray_count = 1;
 
@@ -796,12 +805,9 @@ static int remove_cleanup(PINT_client_sm
 	PINT_acache_release(sm_p->pinode);
     }
 
-    /* in the single message case (formerly msgpair), msgarray points to the
-     * single statically allocated msgpair member.  so free only if dynamically
-     * allocated */
-    if (sm_p->msgarray != &(sm_p->msgpair) ) {
+    if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
+    {
         free(sm_p->msgarray);
-        sm_p->msgarray = NULL;
     }
     if (sm_p->u.remove.datafile_handles)
     {



More information about the PVFS2-CVS mailing list