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
bc8e97cd
Commit
bc8e97cd
authored
Jan 21, 2014
by
vysheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #40 from antma/master
fix very small memory leaks
parents
ea2dbbdf
167fcea0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
binlog.c
binlog.c
+1
-0
mtproto-client.c
mtproto-client.c
+11
-5
structures.c
structures.c
+2
-1
No files found.
binlog.c
View file @
bc8e97cd
...
@@ -628,6 +628,7 @@ void replay_log_event (void) {
...
@@ -628,6 +628,7 @@ void replay_log_event (void) {
struct
chat
*
C
=
&
_C
->
chat
;
struct
chat
*
C
=
&
_C
->
chat
;
if
(
C
->
title
)
{
tfree_str
(
C
->
title
);
}
if
(
C
->
title
)
{
tfree_str
(
C
->
title
);
}
C
->
title
=
fetch_str_dup
();
C
->
title
=
fetch_str_dup
();
if
(
C
->
print_title
)
{
tfree_str
(
C
->
print_title
);
}
C
->
print_title
=
create_print_name
(
C
->
id
,
C
->
title
,
0
,
0
,
0
);
C
->
print_title
=
create_print_name
(
C
->
id
,
C
->
title
,
0
,
0
,
0
);
#ifdef USE_LUA
#ifdef USE_LUA
lua_chat_update
(
C
);
lua_chat_update
(
C
);
...
...
mtproto-client.c
View file @
bc8e97cd
...
@@ -428,6 +428,12 @@ int process_respq_answer (struct connection *c, char *packet, int len) {
...
@@ -428,6 +428,12 @@ int process_respq_answer (struct connection *c, char *packet, int len) {
return
rpc_send_packet
(
c
);
return
rpc_send_packet
(
c
);
}
}
int
check_prime
(
BIGNUM
*
p
)
{
int
r
=
BN_is_prime
(
p
,
BN_prime_checks
,
0
,
BN_ctx
,
0
);
ensure
(
r
>=
0
);
return
r
;
}
int
check_DH_params
(
BIGNUM
*
p
,
int
g
)
{
int
check_DH_params
(
BIGNUM
*
p
,
int
g
)
{
if
(
g
<
2
||
g
>
7
)
{
return
-
1
;
}
if
(
g
<
2
||
g
>
7
)
{
return
-
1
;
}
BIGNUM
t
;
BIGNUM
t
;
...
@@ -440,7 +446,7 @@ int check_DH_params (BIGNUM *p, int g) {
...
@@ -440,7 +446,7 @@ int check_DH_params (BIGNUM *p, int g) {
int
x
=
BN_get_word
(
&
t
);
int
x
=
BN_get_word
(
&
t
);
assert
(
x
>=
0
&&
x
<
4
*
g
);
assert
(
x
>=
0
&&
x
<
4
*
g
);
BN_
clear
(
&
dh_g
);
BN_
free
(
&
dh_g
);
switch
(
g
)
{
switch
(
g
)
{
case
2
:
case
2
:
...
@@ -462,15 +468,15 @@ int check_DH_params (BIGNUM *p, int g) {
...
@@ -462,15 +468,15 @@ int check_DH_params (BIGNUM *p, int g) {
break
;
break
;
}
}
if
(
!
BN_is_prime
(
p
,
BN_prime_checks
,
0
,
BN_ctx
,
0
))
{
return
-
1
;
}
if
(
!
check_prime
(
p
))
{
return
-
1
;
}
BIGNUM
b
;
BIGNUM
b
;
BN_init
(
&
b
);
BN_init
(
&
b
);
ensure
(
BN_set_word
(
&
b
,
2
));
ensure
(
BN_set_word
(
&
b
,
2
));
ensure
(
BN_div
(
&
t
,
0
,
p
,
&
b
,
BN_ctx
));
ensure
(
BN_div
(
&
t
,
0
,
p
,
&
b
,
BN_ctx
));
if
(
!
BN_is_prime
(
&
t
,
BN_prime_checks
,
0
,
BN_ctx
,
0
))
{
return
-
1
;
}
if
(
!
check_prime
(
&
t
))
{
return
-
1
;
}
BN_
clear
(
&
b
);
BN_
free
(
&
b
);
BN_
clear
(
&
t
);
BN_
free
(
&
t
);
return
0
;
return
0
;
}
}
...
...
structures.c
View file @
bc8e97cd
...
@@ -1327,6 +1327,7 @@ void fetch_geo_message (struct message *M) {
...
@@ -1327,6 +1327,7 @@ void fetch_geo_message (struct message *M) {
fetch_message_action
(
&
M
->
action
);
fetch_message_action
(
&
M
->
action
);
}
else
{
}
else
{
M
->
message
=
fetch_str_dup
();
M
->
message
=
fetch_str_dup
();
M
->
message_len
=
strlen
(
M
->
message
);
fetch_message_media
(
&
M
->
media
);
fetch_message_media
(
&
M
->
media
);
}
}
}
}
...
@@ -1691,7 +1692,7 @@ void free_message_action (struct message_action *M) {
...
@@ -1691,7 +1692,7 @@ void free_message_action (struct message_action *M) {
void
free_message
(
struct
message
*
M
)
{
void
free_message
(
struct
message
*
M
)
{
if
(
!
M
->
service
)
{
if
(
!
M
->
service
)
{
if
(
M
->
message
)
{
tfree
_str
(
M
->
message
);
}
if
(
M
->
message
)
{
tfree
(
M
->
message
,
M
->
message_len
+
1
);
}
free_message_media
(
&
M
->
media
);
free_message_media
(
&
M
->
media
);
}
else
{
}
else
{
free_message_action
(
&
M
->
action
);
free_message_action
(
&
M
->
action
);
...
...
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