Skip to content
Snippets Groups Projects
Commit 07f7d32f authored by burneykb's avatar burneykb
Browse files

utilize jakes frontend_free_nodedata where necissary

parent 0323fe99
No related branches found
No related tags found
No related merge requests found
......@@ -155,7 +155,7 @@ int isNumber(char *number) {
int convert_to_id(struct backend_conn * conn, char **argv, struct convert_data * convert_data, int conversion_requirement) {
/* variables used to search for id values */
size_t num_nodes = 0, i;
struct frontend_node_data* search_data;
struct frontend_node_data* search_data = NULL;
int search_1 = 0, search_2 = 0;
const struct graph_node_type * node_definition;
......@@ -177,8 +177,10 @@ int convert_to_id(struct backend_conn * conn, char **argv, struct convert_data *
return 0;
}
search_data = malloc(sizeof((*search_data)) * num_nodes);
/**
* node_data must be NULL,
* num_nodes must equal zero.
*/
if (frontend_getnodes(conn, &search_data, &num_nodes)) {
return 1;
}
......@@ -229,9 +231,6 @@ int convert_to_id(struct backend_conn * conn, char **argv, struct convert_data *
}
}
}
for(i = 0; i < num_nodes; ++i) {
free(search_data[i].name);
}
free(search_data);
frontend_free_nodedata(search_data, num_nodes);
return search_2;
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
int cli_getnodes(struct backend_conn * conn, int argc, char ** argv) {
size_t num_nodes = 0;
struct frontend_node_data * node_data;
struct frontend_node_data * node_data = NULL;
int needHelp = 0;
......@@ -30,8 +30,10 @@ int cli_getnodes(struct backend_conn * conn, int argc, char ** argv) {
return 1;
}
node_data = malloc(sizeof(*node_data));
/**
* node_data must be NULL,
* num_nodes must equal zero.
*/
if (frontend_getnodes(conn, &node_data, &num_nodes)) {
free(node_data);
return 1;
......@@ -66,12 +68,9 @@ int cli_getnodes(struct backend_conn * conn, int argc, char ** argv) {
printf(" %s ", node_definition->output_names[n]);
}
printf("}\n");
free(node_data[i].name);
}
free(node_data);
frontend_free_nodedata(node_data, num_nodes);
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment