Line 15:
newtask = (struct task *) malloc(sizeof(struct task));
newtask->pid = pid;
...
Should be:
newtask = (struct task *) malloc(sizeof(struct task));
if(newtask == NULL)
return NULL;
newtask->pid = pid;
...
I am attaching the diff.
Cheers,
Gaurav
http://sf.net/users/mastergaurav
task.c Diff (diff -u task.c new_task.c)