Commit 41d83b5b authored by Moritz Lipp's avatar Moritz Lipp

Fix memory leak

parent 23c44e3d
/* See LICENSE file for license and copyright information */
#include "girara-datastructures.h"
#include <stdlib.h>
#include <glib.h>
#include "girara-datastructures.h"
struct girara_tree_node_s
{
girara_free_function_t free; /**> The free function */
......@@ -332,6 +334,12 @@ girara_list_t* girara_node_get_children(girara_tree_node_t* node)
return list;
}
void
girara_list_free_data(void* data)
{
free(data);
}
size_t girara_node_get_num_children(girara_tree_node_t* node)
{
g_return_val_if_fail(node && node->node, 0);
......
......@@ -127,6 +127,13 @@ void girara_list_iterator_set(girara_list_iterator_t* iter, void *data);
*/
void girara_list_iterator_free(girara_list_iterator_t* iter);
/**
* Free function to just call free on the data
*
* @param data List data
*/
void girara_list_free_data(void* data);
/**
* Create a new node.
*
......
......@@ -449,6 +449,7 @@ girara_session_destroy(girara_session_t* session)
girara_argument_mapping_t* argument_mapping = session->config.argument_mappings;
while (argument_mapping) {
girara_argument_mapping_t* tmp = argument_mapping->next;
g_free(argument_mapping->identifier);
g_slice_free(girara_argument_mapping_t, argument_mapping);
argument_mapping = tmp;
}
......@@ -1484,6 +1485,8 @@ girara_callback_inputbar_activate(GtkEntry* entry, girara_session_t* session)
return FALSE;
}
girara_list_set_free_function(argument_list, girara_list_free_data);
for(int i = 1; i < argc; i++) {
girara_list_append(argument_list, (void*) g_strdup(argv[i]));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment