Maybe something along these lines. Note, I'm just typing this, it's note tested or anything:
Code:
typedef struct
{
gchar *first_name;
gchar *last_name;
/* etc... */
} Student;
Student *
student_new (const gchar *first, const gchar *last)
{
Student *s = g_slice_new (Student);
s->first_name = g_strdup (first);
s->last_name = g_strdup (last);
/* 'first' and 'last' strings from calling function can be freed */
return s;
}
void
student_free (Student *s)
{
if (s->first_name) g_free (s->first_name);
if (s->last_name) g_free (s->last_name);
g_slice_free (Student, s);
}