projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e152b33
)
Memleak: free the nttlist (network host list) on exit
author
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 14 Nov 2010 22:08:44 +0000
(23:08 +0100)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 14 Nov 2010 22:08:44 +0000
(23:08 +0100)
citadel/file_ops.c
patch
|
blob
|
history
diff --git
a/citadel/file_ops.c
b/citadel/file_ops.c
index 2e7c4f707e0dfc84c48efed2ff03d50a00194be4..e4453cbdbdc3b97f055403caa48dc0a467f57e7c 100644
(file)
--- a/
citadel/file_ops.c
+++ b/
citadel/file_ops.c
@@
-48,9
+48,9
@@
/*
* network_talking_to() -- concurrency checker
*/
/*
* network_talking_to() -- concurrency checker
*/
+static char *nttlist = NULL;
int network_talking_to(char *nodename, int operation) {
int network_talking_to(char *nodename, int operation) {
- static char *nttlist = NULL;
char *ptr = NULL;
int i;
char buf[SIZ];
char *ptr = NULL;
int i;
char buf[SIZ];
@@
-102,6
+102,14
@@
int network_talking_to(char *nodename, int operation) {
return(retval);
}
return(retval);
}
+void cleanup_nttlist(void)
+{
+ begin_critical_section(S_NTTLIST);
+ if (nttlist != NULL)
+ free(nttlist);
+ nttlist = NULL;
+ end_critical_section(S_NTTLIST);
+}
@@
-824,6
+832,7
@@
CTDL_MODULE_INIT(file_ops)
CtdlRegisterProtoHook(cmd_nuop, "NUOP", "Open a network spool file for upload");
CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Open an image file for download");
CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Upload an image file");
CtdlRegisterProtoHook(cmd_nuop, "NUOP", "Open a network spool file for upload");
CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Open an image file for download");
CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Upload an image file");
+ CtdlRegisterCleanupHook(cleanup_nttlist);
}
/* return our Subversion id for the Log */
return "file_ops";
}
/* return our Subversion id for the Log */
return "file_ops";