Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mdmngr
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IOPSYS
mdmngr
Commits
bb272ad8
Commit
bb272ad8
authored
7 years ago
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
fix freeing stack memory during post requests
parent
82adfffb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dongle_network.c
+2
-3
2 additions, 3 deletions
dongle_network.c
libmobile.c
+4
-5
4 additions, 5 deletions
libmobile.c
with
6 additions
and
8 deletions
dongle_network.c
+
2
−
3
View file @
bb272ad8
...
@@ -26,7 +26,6 @@ int get_signal_strength(struct ubus_context *ctx, struct ubus_object *obj,
...
@@ -26,7 +26,6 @@ int get_signal_strength(struct ubus_context *ctx, struct ubus_object *obj,
ip_addr
=
(
char
*
)
blobmsg_data
(
tb
[
IP
]);
ip_addr
=
(
char
*
)
blobmsg_data
(
tb
[
IP
]);
response
=
mobile_get_rssi
(
ip_addr
);
response
=
mobile_get_rssi
(
ip_addr
);
if
(
!
response
)
if
(
!
response
)
goto
fail_unknown
;
goto
fail_unknown
;
...
@@ -51,8 +50,8 @@ int connect_network(struct ubus_context *ctx, struct ubus_object *obj,
...
@@ -51,8 +50,8 @@ int connect_network(struct ubus_context *ctx, struct ubus_object *obj,
goto
fail_argument
;
goto
fail_argument
;
}
}
ip_addr
=
(
char
*
)
blobmsg_data
(
tb
[
IP
]);
ip_addr
=
(
char
*
)
blobmsg_data
(
tb
[
IP
]);
response
=
mobile_connect_network
(
ip_addr
);
response
=
mobile_connect_network
(
ip_addr
);
if
(
!
response
)
if
(
!
response
)
goto
fail_unknown
;
goto
fail_unknown
;
...
@@ -78,8 +77,8 @@ int disconnect(struct ubus_context *ctx, struct ubus_object *obj,
...
@@ -78,8 +77,8 @@ int disconnect(struct ubus_context *ctx, struct ubus_object *obj,
goto
fail_argument
;
goto
fail_argument
;
}
}
ip_addr
=
(
char
*
)
blobmsg_data
(
tb
[
IP
]);
ip_addr
=
(
char
*
)
blobmsg_data
(
tb
[
IP
]);
response
=
mobile_disconnect_network
(
ip_addr
);
response
=
mobile_disconnect_network
(
ip_addr
);
if
(
!
response
)
if
(
!
response
)
goto
fail_unknown
;
goto
fail_unknown
;
...
...
This diff is collapsed.
Click to expand it.
libmobile.c
+
4
−
5
View file @
bb272ad8
...
@@ -299,6 +299,7 @@ static struct json_object *prepare_request(char *ip_addr, char *query, int optio
...
@@ -299,6 +299,7 @@ static struct json_object *prepare_request(char *ip_addr, char *query, int optio
else
if
(
option
==
GET
)
{
else
if
(
option
==
GET
)
{
query
=
get_query_wrapper
(
ip_addr
,
query
);
query
=
get_query_wrapper
(
ip_addr
,
query
);
rv
=
perform_get_request
(
ip_addr
,
curl
,
query
,
&
str
);
rv
=
perform_get_request
(
ip_addr
,
curl
,
query
,
&
str
);
free
(
query
);
}
else
}
else
goto
fail_request
;
goto
fail_request
;
...
@@ -308,7 +309,6 @@ static struct json_object *prepare_request(char *ip_addr, char *query, int optio
...
@@ -308,7 +309,6 @@ static struct json_object *prepare_request(char *ip_addr, char *query, int optio
}
}
if
(
!
str
.
ptr
)
if
(
!
str
.
ptr
)
goto
fail_ptr
;
goto
fail_ptr
;
//debug_print("%s\n", str.ptr);
//debug_print("%s\n", str.ptr);
parsed_response
=
json_tokener_parse
(
str
.
ptr
);
parsed_response
=
json_tokener_parse
(
str
.
ptr
);
if
(
!
parsed_response
)
{
if
(
!
parsed_response
)
{
...
@@ -316,7 +316,6 @@ static struct json_object *prepare_request(char *ip_addr, char *query, int optio
...
@@ -316,7 +316,6 @@ static struct json_object *prepare_request(char *ip_addr, char *query, int optio
goto
fail_json
;
goto
fail_json
;
}
}
free
(
query
);
curl_cleaner
(
curl
);
curl_cleaner
(
curl
);
free
(
str
.
ptr
);
free
(
str
.
ptr
);
return
parsed_response
;
return
parsed_response
;
...
@@ -380,12 +379,12 @@ finished:
...
@@ -380,12 +379,12 @@ finished:
struct
json_object
*
mobile_connect_network
(
char
*
ip_addr
)
struct
json_object
*
mobile_connect_network
(
char
*
ip_addr
)
{
{
return
prepare_request
(
ip_addr
,
"isTest=false&goformId=CONNECT_NETWORK"
,
POST
);
return
prepare_request
(
ip_addr
,
"isTest=false&
notCallback=true&
goformId=CONNECT_NETWORK"
,
POST
);
}
}
struct
json_object
*
mobile_disconnect_network
(
char
*
ip_addr
)
struct
json_object
*
mobile_disconnect_network
(
char
*
ip_addr
)
{
{
return
prepare_request
(
ip_addr
,
"isTest=false&goformId=DISCONNECT_NETWORK"
,
POST
);
return
prepare_request
(
ip_addr
,
"isTest=false&
notCallback=true&
goformId=DISCONNECT_NETWORK"
,
POST
);
}
}
struct
json_object
*
mobile_delete_apn
(
char
*
ip_addr
,
char
*
name
)
struct
json_object
*
mobile_delete_apn
(
char
*
ip_addr
,
char
*
name
)
...
@@ -475,7 +474,7 @@ struct json_object *mobile_get_pin_status(char *ip_addr)
...
@@ -475,7 +474,7 @@ struct json_object *mobile_get_pin_status(char *ip_addr)
struct
json_object
*
mobile_get_rssi
(
char
*
ip_addr
)
struct
json_object
*
mobile_get_rssi
(
char
*
ip_addr
)
{
{
return
prepare_request
(
ip_addr
,
"rssi"
,
GET
);
return
prepare_request
(
ip_addr
,
"
lte_
rssi"
,
GET
);
}
}
struct
json_object
*
mobile_get_modem_state
(
char
*
ip_addr
)
struct
json_object
*
mobile_get_modem_state
(
char
*
ip_addr
)
...
...
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