Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Distributed Autonomous Networked Control Lab
MicroCART
Commits
c9eee6cc
Unverified
Commit
c9eee6cc
authored
8 years ago
by
Jake Drahos
Browse files
Options
Downloads
Patches
Plain Diff
Fixed memory leak in frontend_nodes
parent
dd8d7f4c
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
groundStation/src/frontend/frontend_nodes.c
+21
-3
21 additions, 3 deletions
groundStation/src/frontend/frontend_nodes.c
groundStation/src/frontend/frontend_nodes.h
+10
-3
10 additions, 3 deletions
groundStation/src/frontend/frontend_nodes.h
with
31 additions
and
6 deletions
groundStation/src/frontend/frontend_nodes.c
+
21
−
3
View file @
c9eee6cc
...
@@ -11,14 +11,22 @@
...
@@ -11,14 +11,22 @@
*
*
* Returns 0 on success, 1 on error
* Returns 0 on success, 1 on error
*
*
* node_data and num_nodes are out-pointers.
* node_data must be a pointer to NULL
* num_nodes must be a pointer to zero
*
*
* Note : node_data may be resized inside this function.
* That is why you must pass in a strcut ... **
*/
*/
int
frontend_getnodes
(
int
frontend_getnodes
(
struct
backend_conn
*
conn
,
struct
backend_conn
*
conn
,
struct
frontend_node_data
**
node_data
,
struct
frontend_node_data
**
node_data
,
size_t
*
num_nodes
)
{
size_t
*
num_nodes
)
{
if
((
node_data
==
NULL
)
||
(
num_nodes
==
NULL
))
{
return
1
;
}
if
((
*
node_data
!=
NULL
)
||
(
*
num_nodes
!=
0
))
{
return
1
;
}
char
msg
[
64
]
=
""
;
char
msg
[
64
]
=
""
;
int
written
;
int
written
;
...
@@ -122,4 +130,14 @@ int frontend_addnode(
...
@@ -122,4 +130,14 @@ int frontend_addnode(
}
}
return
0
;
return
0
;
}
}
\ No newline at end of file
void
frontend_free_node_data
(
struct
frontend_node_data
*
nd
,
size_t
num_nodes
)
{
for
(
size_t
i
=
0
;
i
<
num_nodes
;
i
++
)
{
free
(
nd
[
i
].
name
);
}
free
(
nd
);
}
This diff is collapsed.
Click to expand it.
groundStation/src/frontend/frontend_nodes.h
+
10
−
3
View file @
c9eee6cc
...
@@ -8,8 +8,10 @@
...
@@ -8,8 +8,10 @@
*
*
* Returns 0 on success, 1 on error
* Returns 0 on success, 1 on error
*
*
* Note : node_data may be resized inside this function.
* node_data and num_nodes are out pointers
* That is why you must pass in a strcut ... **
* node_data must point to a NULL pointer
* num_nodes must point to zero
*
*/
*/
int
frontend_getnodes
(
int
frontend_getnodes
(
struct
backend_conn
*
conn
,
struct
backend_conn
*
conn
,
...
@@ -25,4 +27,9 @@ int frontend_addnode(
...
@@ -25,4 +27,9 @@ int frontend_addnode(
struct
backend_conn
*
conn
,
struct
backend_conn
*
conn
,
struct
frontend_node_data
*
node_data
);
struct
frontend_node_data
*
node_data
);
#endif
/* __FRONTEND_NODES_H */
/* Free a node_data array */
\ No newline at end of file
void
frontend_free_node_data
(
struct
frontend_node_data
*
nd
,
size_t
num_nodes
);
#endif
/* __FRONTEND_NODES_H */
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