Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
6
66
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Eric Vidal
66
Commits
9ecc3c73
Commit
9ecc3c73
authored
6 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
be clean with heap memory
parent
8d6ac0a5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib66/ssexec_disable.c
+18
-7
18 additions, 7 deletions
src/lib66/ssexec_disable.c
with
18 additions
and
7 deletions
src/lib66/ssexec_disable.c
+
18
−
7
View file @
9ecc3c73
...
...
@@ -56,23 +56,30 @@ int svc_remove(genalloc *tostop,ss_resolve_t *res, char const *src,ssexec_t *inf
unsigned
int
i
=
0
;
genalloc
rdeps
=
GENALLOC_ZERO
;
stralloc
dst
=
STRALLOC_ZERO
;
ss_resolve_t
cp
=
RESOLVE_ZERO
;
size_t
newlen
;
char
*
name
=
res
->
sa
.
s
+
res
->
name
;
if
(
!
ss_resolve_copy
(
&
cp
,
res
))
{
VERBO1
strerr_warnwu1sys
(
"copy resolve file"
)
;
goto
err
;
}
if
(
!
stralloc_cats
(
&
dst
,
src
))
goto
err
;
if
(
res
->
type
==
CLASSIC
)
if
(
cp
.
type
==
CLASSIC
)
{
if
(
!
stralloc_cats
(
&
dst
,
SS_SVC
))
goto
err
;
}
else
if
(
!
stralloc_cats
(
&
dst
,
SS_DB
SS_SRC
))
retstralloc
(
0
,
"remove_sv"
)
;
if
(
!
stralloc_cats
(
&
dst
,
"/"
))
goto
err
;
newlen
=
dst
.
len
;
if
(
!
ss_resolve_add_rdeps
(
&
rdeps
,
res
,
info
))
if
(
!
ss_resolve_add_rdeps
(
&
rdeps
,
&
cp
,
info
))
{
VERBO1
strerr_warnwu2sys
(
"resolve recursive dependencies of: "
,
name
)
;
goto
err
;
}
ss_resolve_free
(
&
cp
)
;
if
(
!
ss_resolve_add_logger
(
&
rdeps
,
info
))
{
VERBO1
strerr_warnwu1sys
(
"resolve logger"
)
;
...
...
@@ -106,13 +113,16 @@ int svc_remove(genalloc *tostop,ss_resolve_t *res, char const *src,ssexec_t *inf
goto
err
;
}
if
(
!
ss_resolve_cmp
(
tostop
,
name
))
if
(
!
genalloc_append
(
ss_resolve_
t
,
tostop
,
pres
))
goto
err
;
if
(
!
ss_resolve_
append
(
tostop
,
pres
))
goto
err
;
}
genalloc_deepfree
(
ss_resolve_t
,
&
rdeps
,
ss_resolve_free
)
;
stralloc_free
(
&
dst
)
;
return
1
;
err:
ss_resolve_free
(
&
cp
)
;
genalloc_deepfree
(
ss_resolve_t
,
&
rdeps
,
ss_resolve_free
)
;
stralloc_free
(
&
dst
)
;
return
0
;
}
...
...
@@ -164,7 +174,6 @@ int ssexec_disable(int argc, char const *const *argv,char const *const *envp,sse
cleanup
(
workdir
.
s
)
;
strerr_dief1x
(
110
,
"nice try peon"
)
;
}
ss_resolve_init
(
&
res
)
;
logname
=
get_rstrlen_until
(
name
,
SS_LOG_SUFFIX
)
;
if
(
logname
>
0
)
{
...
...
@@ -185,6 +194,7 @@ int ssexec_disable(int argc, char const *const *argv,char const *const *envp,sse
if
(
!
res
.
disen
)
{
VERBO1
strerr_warni2x
(
name
,
": is already disabled"
)
;
ss_resolve_free
(
&
res
)
;
continue
;
}
if
(
!
svc_remove
(
&
tostop
,
&
res
,
workdir
.
s
,
info
))
...
...
@@ -194,6 +204,7 @@ int ssexec_disable(int argc, char const *const *argv,char const *const *envp,sse
}
if
(
res
.
type
==
CLASSIC
)
nclassic
++
;
else
nlongrun
++
;
ss_resolve_free
(
&
res
)
;
}
if
(
nclassic
)
...
...
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