Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
9b780838
Commit
9b780838
authored
Nov 07, 2016
by
Bi-Ruei, Chiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Free memory allocated in asn1c_compiled_output() and asn1c_lang_C_type_SEx_OF_def()
parent
12021b53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+2
-0
libasn1compiler/asn1compiler.c
libasn1compiler/asn1compiler.c
+29
-0
No files found.
libasn1compiler/asn1c_C.c
View file @
9b780838
...
...
@@ -813,6 +813,8 @@ asn1c_lang_C_type_SEx_OF_def(arg_t *arg, int seq_of) {
arg
->
embed
++
;
emit_member_table
(
arg
,
v
);
arg
->
embed
--
;
free
(
v
->
Identifier
);
v
->
Identifier
=
(
char
*
)
NULL
;
INDENT
(
-
1
);
OUT
(
"};
\n
"
);
...
...
libasn1compiler/asn1compiler.c
View file @
9b780838
...
...
@@ -6,6 +6,7 @@
static
void
default_logger_cb
(
int
,
const
char
*
fmt
,
...);
static
int
asn1c_compile_expr
(
arg_t
*
arg
);
static
int
asn1c_attach_streams
(
asn1p_expr_t
*
expr
);
static
int
asn1c_detach_streams
(
asn1p_expr_t
*
expr
);
int
asn1_compile
(
asn1p_t
*
asn
,
const
char
*
datadir
,
enum
asn1c_flags
flags
,
...
...
@@ -61,6 +62,12 @@ asn1_compile(asn1p_t *asn, const char *datadir, enum asn1c_flags flags,
if
(
asn1c_save_compiled_output
(
arg
,
datadir
,
argc
,
optc
,
argv
))
return
-
1
;
TQ_FOR
(
mod
,
&
(
asn
->
modules
),
mod_next
)
{
TQ_FOR
(
arg
->
expr
,
&
(
mod
->
members
),
next
)
{
asn1c_detach_streams
(
arg
->
expr
);
}
}
return
0
;
}
...
...
@@ -159,6 +166,28 @@ asn1c_attach_streams(asn1p_expr_t *expr) {
return
0
;
}
int
asn1c_detach_streams
(
asn1p_expr_t
*
expr
)
{
compiler_streams_t
*
cs
;
out_chunk_t
*
m
;
int
i
;
if
(
!
expr
->
data
)
return
0
;
/* Already detached? */
cs
=
expr
->
data
;
for
(
i
=
0
;
i
<
OT_MAX
;
i
++
)
{
while
((
m
=
TQ_REMOVE
(
&
(
cs
->
destination
[
i
].
chunks
),
next
)))
{
free
(
m
->
buf
);
free
(
m
);
}
}
free
(
expr
->
data
);
expr
->
data
=
(
void
*
)
NULL
;
return
0
;
}
static
void
default_logger_cb
(
int
_severity
,
const
char
*
fmt
,
...)
{
va_list
ap
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment