Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
bb21fc5e
Commit
bb21fc5e
authored
Sep 11, 2014
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed memory leak
parent
2e0a7fda
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
1 deletion
+37
-1
auto-static.c
auto-static.c
+33
-1
auto.h
auto.h
+2
-0
generate.c
generate.c
+1
-0
queries.c
queries.c
+1
-0
No files found.
auto-static.c
View file @
bb21fc5e
...
...
@@ -135,6 +135,20 @@ static struct paramed_type *paramed_type_dup (struct paramed_type *P) {
return
R
;
}
void
tgl_paramed_type_free
(
struct
paramed_type
*
P
)
{
if
(
ODDP
(
P
))
{
return
;
}
if
(
P
->
type
->
params_num
)
{
int
i
;
for
(
i
=
0
;
i
<
P
->
type
->
params_num
;
i
++
)
{
tgl_paramed_type_free
(
P
->
params
[
i
]);
}
free
(
P
->
params
);
}
free
(
P
->
type
->
id
);
free
(
P
->
type
);
free
(
P
);
}
static
void
print_offset
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
multiline_offset
;
i
++
)
{
...
...
@@ -277,6 +291,23 @@ static void local_next_token (void) {
}
}
#define MAX_FVARS 100
static
struct
paramed_type
*
fvars
[
MAX_FVARS
];
static
int
fvars_pos
;
void
add_var_to_be_freed
(
struct
paramed_type
*
P
)
{
assert
(
fvars_pos
<
MAX_FVARS
);
fvars
[
fvars_pos
++
]
=
P
;
}
void
free_vars_to_be_freed
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
fvars_pos
;
i
++
)
{
tgl_paramed_type_free
(
fvars
[
i
]);
}
fvars_pos
=
0
;
}
int
tglf_extf_autocomplete
(
const
char
*
text
,
int
text_len
,
int
index
,
char
**
R
,
char
*
data
,
int
data_len
)
{
if
(
index
==
-
1
)
{
buffer_pos
=
data
;
...
...
@@ -284,6 +315,7 @@ int tglf_extf_autocomplete (const char *text, int text_len, int index, char **R,
autocomplete_mode
=
0
;
local_next_token
();
autocomplete_function_any
();
free_vars_to_be_freed
();
}
if
(
autocomplete_mode
==
0
)
{
return
-
1
;
}
int
len
=
strlen
(
text
);
...
...
@@ -302,7 +334,7 @@ int tglf_extf_autocomplete (const char *text, int text_len, int index, char **R,
}
}
struct
paramed_type
*
tglf_extf_store
(
const
char
*
data
,
int
data_len
)
{
struct
paramed_type
*
tglf_extf_store
(
const
char
*
data
,
int
data_len
)
{
buffer_pos
=
(
char
*
)
data
;
buffer_end
=
(
char
*
)(
data
+
data_len
);
local_next_token
();
...
...
auto.h
View file @
bb21fc5e
...
...
@@ -41,6 +41,8 @@ struct paramed_type {
#define INT2PTR(x) (void *)(long)(((long)x) * 2 + 1)
#define PTR2INT(x) ((((long)x) - 1) / 2)
void
tgl_paramed_type_free
(
struct
paramed_type
*
P
);
#include "auto/auto-header.h"
#endif
generate.c
View file @
bb21fc5e
...
...
@@ -713,6 +713,7 @@ int gen_field_autocomplete_excl (struct arg *arg, int *vars, int num, int from_f
assert
(
t
==
NODE_TYPE_TYPE
||
t
==
NODE_TYPE_VAR_TYPE
);
printf
(
"%sstruct paramed_type *field%d = autocomplete_function_any ();
\n
"
,
offset
,
num
);
printf
(
"%sif (!field%d) { return 0; }
\n
"
,
offset
,
num
);
printf
(
"%sadd_var_to_be_freed (field%d);
\n
"
,
offset
,
num
);
static
char
s
[
20
];
sprintf
(
s
,
"field%d"
,
num
);
gen_uni_skip
(
arg
->
type
,
s
,
vars
,
1
,
1
);
...
...
queries.c
View file @
bb21fc5e
...
...
@@ -3475,6 +3475,7 @@ static int ext_query_on_answer (struct query *q UU) {
char
*
buf
=
tglf_extf_fetch
(
q
->
type
);
((
void
(
*
)(
void
*
,
int
,
char
*
))
q
->
callback
)
(
q
->
callback_extra
,
1
,
buf
);
}
tgl_paramed_type_free
(
q
->
type
);
return
0
;
}
...
...
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