#include <opensync/opensync.h>
#include <opensync/opensync-group.h>

int main(int argc, char *argv[]) {
	
	OSyncList *groups, *g;
	int i = 0;
	
	osync_bool couldloadgroups;
	
	OSyncGroup *group = NULL;
	OSyncGroupEnv *groupenv = NULL;
	
	groupenv = osync_group_env_new(NULL);
	/* load groups from default dir */
	couldloadgroups = osync_group_env_load_groups(groupenv, NULL, NULL);
	
	if ( !couldloadgroups ) {
		/* print error */
		printf("Could not load groups.");
		return -1;
	}
	
	groups = osync_group_env_get_groups(groupenv);
	printf("found %i groups\n", osync_list_length(groups));
	
	for (g = groups; g; g = g->next) {
		group = (OSyncGroup *) g->data;
		printf("group nr. %i is %s\n", i+1, osync_group_get_name(group));
	}
	
	/* free env */
	osync_group_env_unref(groupenv);
	
	return 0;
}

#include <opensync/opensync.h>
#include <opensync/opensync-group.h>

int main(int argc, char *argv[]) {
	
	OSyncList *groups, *g;
	int i = 0;
	
	osync_bool couldloadgroups;
	
	OSyncGroup *group = NULL;
	OSyncGroupEnv *groupenv = NULL;
	
	groupenv = osync_group_env_new(NULL);
	/* load groups from default dir */
	couldloadgroups = osync_group_env_load_groups(groupenv, NULL, NULL);
	
	if ( !couldloadgroups ) {
		/* print error */
		printf("Could not load groups.");
		return -1;
	}
	
	groups = osync_group_env_get_groups(groupenv);
	printf("found %i groups\n", osync_list_length(groups));
	
	for (g = groups; g; g = g->next) {
		group = (OSyncGroup *) g->data;
		printf("group nr. %i is %s\n", i+1, osync_group_get_name(group));
	}

	/* Free the list */
	osync_list_free(groups);
	
	/* free env */
	osync_group_env_unref(groupenv);
	
	return 0;
}

Fix potential memory leak - freeing the newly created OSyncList was missing
Fix potential memory leak - freeing the newly created OSyncList was
missing


git-svn-id: e31799a7ad59d6ea355ca047c69e0aee8a59fcd3@5736 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e
