[torqueusers] hunting for memory leaks (1.2.0p6)
Wolfgang Wander
wwc at rentec.com
Tue Sep 20 13:24:07 MDT 2005
I'm in the process to hunt down memory leaks. Valgrind is a good
tool here and it seems that libc and ldap in suse9.2 are to blame
for a lot. Here are a few patches that might be useful once the
bigger ldap problem is under control:
----------------------------------------------------------------------
the missing ~ clears out the wrong bits:
----------------------------------------------------------------------
diff -c -r torque-1.2.0p6orig/src/lib/Libattr/attr_fn_arst.c torque-1.2.0p6/src/lib/Libattr/attr_fn_arst.c
*** /work/external/wwc/pbs/torque-1.2.0p6wwc/src/lib/Libattr/attr_fn_arst.c Wed Jul 27 02:25:01 2005
--- torque-1.2.0p6/src/lib/Libattr/attr_fn_arst.c Tue Sep 20 15:16:40 2005
***************
*** 249,255 ****
{
free_arst(patr);
! patr->at_flags &= ATR_VFLAG_MODIFY; /* _SET cleared in free_arst */
return(0);
}
--- 249,255 ----
{
free_arst(patr);
! patr->at_flags &= ~ATR_VFLAG_MODIFY; /* _SET cleared in free_arst */
return(0);
}
----------------------------------------------------------------------
from the wrong comments it seems that the free statement was placed
accordingly wrong here:
----------------------------------------------------------------------
diff -c -r torque-1.2.0p6orig/src/server/attr_recov.c torque-1.2.0p6/src/server/attr_recov.c
*** /work/external/wwc/pbs/torque-1.2.0p6wwc/src/server/attr_recov.c Thu Aug 25 18:11:30 2005
--- torque-1.2.0p6/src/server/attr_recov.c Tue Sep 20 13:49:02 2005
***************
*** 498,506 ****
{
log_err(-1,id,"unknown attribute discarded");
continue;
}
! }
(padef + index)->at_decode(
pattr + index,
--- 498,508 ----
{
log_err(-1,id,"unknown attribute discarded");
+ free(pal);
+
continue;
}
! } /* END if (index < 0) */
(padef + index)->at_decode(
pattr + index,
***************
*** 512,522 ****
(padef + index)->at_action(pattr+index,parent,ATR_ACTION_RECOV);
(pattr + index)->at_flags = pal->al_flags & ~ATR_VFLAG_MODIFY;
- } /* END if (index < 0) */
- if (palsize)
free(pal);
return(0);
} /* END recov_attr() */
--- 514,525 ----
(padef + index)->at_action(pattr+index,parent,ATR_ACTION_RECOV);
(pattr + index)->at_flags = pal->al_flags & ~ATR_VFLAG_MODIFY;
free(pal);
+ } /* END while(1) */
+
+
return(0);
} /* END recov_attr() */
----------------------------------------------------------------------
Furtheremore in svr_recov.c this leak here seems intentional, or is
it?
----------------------------------------------------------------------
if (pdef->at_decode(&tempat,pdef->at_name,NULL,buf) < 0)
{
sprintf(log_buffer,"decode of acl %s failed",
pdef->at_name);
log_err(errno,"recov_acl",log_buffer);
}
else if (pdef->at_set(pattr,&tempat,SET) != 0)
{
sprintf(log_buffer,"set of acl %s failed",
pdef->at_name);
log_err(errno,"recov_acl",log_buffer);
}
pdef->at_free(&tempat); /* at_free is set to free_noop and leave
attributes dangling? wwc */
----------------------------------------------------------------------
More information about the torqueusers
mailing list