Memory allocation and cleanup modules when using linked list

[email protected] Wed, 7 Feb 2007 17:51:36 +0530
Newsgroups gmane.linux.real-time.rtlinux.general
Organization cranessoftware
Message-ID <[email protected]>
Hi all,
	We are doing our project in RT Linux and we have a userstart module which 
will be inserted as the last one and contains the init and cleanup module.
	The problem is that we are having a structure which contains a pointer as a 
member and we are creating pointer to that structure. And in init module we 
are allocating memory first for pointer and then for the member (pointer). 
And in cleanup if we free only structure pointer then its ok but mbuff will 
be occupied.But if i free member pointer first then pointer to structure then 
it showing error and lsmod displays all the modules linked like this

MAKE
----
Let it run for 5 sec...
5 sec elapsed
Now stop the application
rmmod userstart
make: *** [test] Segmentation fault
rmmod PHYfunction
PHYfunction: Device or resource busy
make: [test] Error 1 (ignored)
rmmod framecheck
rmmod wep_filter_1b
wep_filter_1b: Device or resource busy
make: [test] Error 1 (ignored)
rmmod defragement_3b
defragement_3b: Device or resource busy
make: [test] Error 1 (ignored)
rmmod Process_Channel_State
Process_Channel_State: Device or resource busy
make: [test] Error 1 (ignored)
rmmod VALIDATE_Frame1
VALIDATE_Frame1: Device or resource busy
make: [test] Error 1 (ignored)

LSMOD
=====
root@subodh RT_LINUX_802.11g_vasanth]# lsmod
Module                  Size  Used by    Tainted: P
userstart                  0   0  (deleted)
PHYfunction             3713   0  [userstart]
wep_filter_1b           1740   0  [userstart]
defragement_3b          3412   0  [wep_filter_1b]
Process_Channel_State    3144   0  [userstart]
VALIDATE_Frame1         1618   0  [userstart PHYfunction]
validate_rx             2893   0  [Process_Channel_State VALIDATE_Frame1]
DataPump                2444   0  [userstart]
main                    1188   0  [DataPump]
Backoff                 2349   0  [userstart Process_Channel_State]
backoff_1               1836   0  [Process_Channel_State DataPump Backoff]
Trnsmit_Coord_STA       2364   0  [userstart]
 
please give a solution for this ...

regards
vimal

_______________________________________________
Rtl mailing list
[email protected]
http://hq.fsmlabs.com/mailman/listinfo/rtl
http:/www.rtlinux-gpl.org/