Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
lyskom-server-ceder-1616-generations-topgit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
a0c16041
Commit
a0c16041
authored
33 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Fixed memory leak. Added dump_allocated_connections().
parent
6e586fdf
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/server/internal-connections.c
+34
-1
34 additions, 1 deletion
src/server/internal-connections.c
with
34 additions
and
1 deletion
src/server/internal-connections.c
+
34
−
1
View file @
a0c16041
...
...
@@ -12,6 +12,7 @@
#include
"internal-connections.h"
#include
"lyskomd.h"
#include
"config.h"
#include
"log.h"
INTERNAL
Connection
*
all_connections
=
NULL
;
...
...
@@ -29,6 +30,8 @@ INTERNAL const Connection EMPTY_CONNECTION =
NULL_CONF_TYPE_i
,
EMPTY_STRING_i
,
0
,
FALSE
,
NO_TIME
,
0
,
FALSE
});
static
int
no_of_allocated_connections
=
0
;
INTERNAL
Connection
*
alloc_connection
(
void
)
{
...
...
@@ -36,6 +39,7 @@ alloc_connection(void)
res
=
smalloc
(
sizeof
(
Connection
)
);
*
res
=
EMPTY_CONNECTION
;
++
no_of_allocated_connections
;
return
res
;
}
...
...
@@ -117,7 +121,29 @@ kill_client(Connection *cp)
last_conn
=
NULL
;
cp
->
magic
=
CONN_MAGIC_FREE
;
s_clear
(
&
cp
->
unparsed
);
s_clear
(
&
cp
->
what_am_i_doing
);
s_clear
(
&
cp
->
username
);
s_clear
(
&
cp
->
hostname
);
if
(
cp
->
mux
!=
NULL
)
{
log
(
"kill_client(): client %d has mux != NULL.
\n
"
,
cp
->
session_no
);
}
if
(
!
s_empty
(
cp
->
c_string0
)
||
!
s_empty
(
cp
->
c_string1
)
||
!
s_empty
(
cp
->
string0
)
)
{
log
(
"kill_client(): unexpected string remains.
\n
"
);
}
if
(
cp
->
c_misc_info_p
!=
NULL
||
cp
->
c_local_text_no_p
!=
NULL
)
log
(
"kill_client(): unexpected remaining data.
\n
"
);
sfree
(
cp
);
--
no_of_allocated_connections
;
}
#ifdef DEFENSIVE_CHECKS
...
...
@@ -201,3 +227,10 @@ traverse_connections (Session_no session_no)
else
return
prev
->
next
->
session_no
;
}
void
dump_allocated_connections
(
FILE
*
fp
)
{
fprintf
(
fp
,
"---"
__FILE__
":
\n\t
Connections: %d
\n
"
,
no_of_allocated_connections
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment