g_list_append (ERROR)



Hello, while running the following code my program sucks always at the same
place:
__________________________________________________
 typedef struct _KRunnerNames KRunnerNames;
struct _KRunnerNames
  {
    gint number;
    gchar *first_name;
    gchar *last_name;
    guint32 time_seconds;
  };

void dummy (void)
{
GList *runnerlist = NULL;
KRunnerNames *runnerptr = NULL;
res = execSQL ("select runner.number,name,vorname  "
		 "from runner "
		 "where lauf_nr = %d and runner.number > 0", run_number);
  for (a = 0; a < PQntuples (res); a++)
    {
    /* ERRROOOR !!!!!!!!!! */
    /* After 130 iterations the program sucks here*/
      runnerptr = create_runner (atoi (PQgetvalue (res, a, 0)), PQgetvalue (res, a, 1),
				 PQgetvalue (res, a, 2), 0);
      runnerlist = g_list_append (runnerlist, runnerptr);
    }
  PQclear (res);
}
  
KRunnerNames *
create_runner (gint number, gchar * last_name, gchar * first_name, guint32 seconds)
{
  KRunnerNames *runnerptr;
  runnerptr = (KRunnerNames *) g_malloc0 (sizeof (KRunnerNames));
  runnerptr->number = number;
  runnerptr->first_name = g_strdup (first_name);
  runnerptr->last_name = g_strdup (last_name);
  runnerptr->time_seconds = seconds;
  return runnerptr;
}

But i think all memory allocations are ok but were else is the error ??
Have i overlooked something ??
Or ist there any other chance to solve this problem ??
Please look at the code and help me if you can.....

Thanks

--
Andreas Scherf
- "If you kiss me, I'll turn into a beautiful princess."
- "Look, I'm a computer programmer. I dont have time for girls,
but a talking frog is very very cool."
+--------------------------------------------+
I EMail    : scherfa@fh-trier.de             I  
I Homepage : http://www.fh-trier.de/~scherfa I
+--------------------------------------------+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]