forking heap problem fully solved FTR.



Please excuse the bandwidth I used for the problem I described previously 
where the child process was invading the  memory the parent was using for 
GTK. It was a very stupid mistake, as you can see below in that the case 
where strrchr() returning NULL is not considered, thus causing a memory error 
in the child. This memory error in turn causes a "X-io error" in the parent.

	if (stat(target,&t_stat)<0){  /* follow link stat() */
		route=(char *)malloc(strlen(target+1));
		if (route) {
		  strcpy(route,target);
		  end=strrchr(route,'/');
		  if (end==route) end[1]=0; /* root directory */
		  else end[0]=0;
		  stat(route,&t_stat);
		  free(route);
		}
	}

Saludos

Edscott Wilson Garcia.




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