apps/speed.c:2650: error: NULL_DEREFERENCE
  pointer `f` last assigned on line 2649 could be null and is dereferenced by call to `fgets()` at line 2650, column 9.
Showing all 36 steps of the trace


apps/speed.c:2610:1: start of procedure do_multi()
2608.       }
2609.   
2610. > static int do_multi(int multi)
2611.   	{
2612.   	int n;

apps/speed.c:2615:2: 
2613.   	int fd[2];
2614.   	int *fds;
2615. > 	static char sep[]=":";
2616.   
2617.   	fds=malloc(multi*sizeof *fds);

apps/speed.c:2617:2: 
2615.   	static char sep[]=":";
2616.   
2617. > 	fds=malloc(multi*sizeof *fds);
2618.   	for(n=0 ; n < multi ; ++n)
2619.   		{

apps/speed.c:2618:6: 
2616.   
2617.   	fds=malloc(multi*sizeof *fds);
2618. > 	for(n=0 ; n < multi ; ++n)
2619.   		{
2620.   		pipe(fd);

apps/speed.c:2618:12: Loop condition is true. Entering loop body
2616.   
2617.   	fds=malloc(multi*sizeof *fds);
2618.   	for(n=0 ; n < multi ; ++n)
                   ^
2619.   		{
2620.   		pipe(fd);

apps/speed.c:2620:3: 
2618.   	for(n=0 ; n < multi ; ++n)
2619.   		{
2620. > 		pipe(fd);
2621.   		fflush(stdout);
2622.   		fflush(stderr);

apps/speed.c:2621:3: 
2619.   		{
2620.   		pipe(fd);
2621. > 		fflush(stdout);
2622.   		fflush(stderr);
2623.   		if(fork())

apps/speed.c:2622:3: 
2620.   		pipe(fd);
2621.   		fflush(stdout);
2622. > 		fflush(stderr);
2623.   		if(fork())
2624.   			{

apps/speed.c:2623:6: Taking true branch
2621.   		fflush(stdout);
2622.   		fflush(stderr);
2623.   		if(fork())
             ^
2624.   			{
2625.   			close(fd[1]);

apps/speed.c:2625:4: 
2623.   		if(fork())
2624.   			{
2625. > 			close(fd[1]);
2626.   			fds[n]=fd[0];
2627.   			}

apps/speed.c:2626:4: 
2624.   			{
2625.   			close(fd[1]);
2626. > 			fds[n]=fd[0];
2627.   			}
2628.   		else

apps/speed.c:2639:3: 
2637.   			return 0;
2638.   			}
2639. > 		printf("Forked child %d\n",n);
2640.   		}
2641.   

apps/speed.c:2618:24: 
2616.   
2617.   	fds=malloc(multi*sizeof *fds);
2618. > 	for(n=0 ; n < multi ; ++n)
2619.   		{
2620.   		pipe(fd);

apps/speed.c:2618:12: Loop condition is true. Entering loop body
2616.   
2617.   	fds=malloc(multi*sizeof *fds);
2618.   	for(n=0 ; n < multi ; ++n)
                   ^
2619.   		{
2620.   		pipe(fd);

apps/speed.c:2620:3: 
2618.   	for(n=0 ; n < multi ; ++n)
2619.   		{
2620. > 		pipe(fd);
2621.   		fflush(stdout);
2622.   		fflush(stderr);

apps/speed.c:2621:3: 
2619.   		{
2620.   		pipe(fd);
2621. > 		fflush(stdout);
2622.   		fflush(stderr);
2623.   		if(fork())

apps/speed.c:2622:3: 
2620.   		pipe(fd);
2621.   		fflush(stdout);
2622. > 		fflush(stderr);
2623.   		if(fork())
2624.   			{

apps/speed.c:2623:6: Taking true branch
2621.   		fflush(stdout);
2622.   		fflush(stderr);
2623.   		if(fork())
             ^
2624.   			{
2625.   			close(fd[1]);

apps/speed.c:2625:4: 
2623.   		if(fork())
2624.   			{
2625. > 			close(fd[1]);
2626.   			fds[n]=fd[0];
2627.   			}

apps/speed.c:2626:4: 
2624.   			{
2625.   			close(fd[1]);
2626. > 			fds[n]=fd[0];
2627.   			}
2628.   		else

apps/speed.c:2639:3: 
2637.   			return 0;
2638.   			}
2639. > 		printf("Forked child %d\n",n);
2640.   		}
2641.   

apps/speed.c:2618:24: 
2616.   
2617.   	fds=malloc(multi*sizeof *fds);
2618. > 	for(n=0 ; n < multi ; ++n)
2619.   		{
2620.   		pipe(fd);

apps/speed.c:2618:12: Loop condition is true. Entering loop body
2616.   
2617.   	fds=malloc(multi*sizeof *fds);
2618.   	for(n=0 ; n < multi ; ++n)
                   ^
2619.   		{
2620.   		pipe(fd);

apps/speed.c:2620:3: 
2618.   	for(n=0 ; n < multi ; ++n)
2619.   		{
2620. > 		pipe(fd);
2621.   		fflush(stdout);
2622.   		fflush(stderr);

apps/speed.c:2621:3: 
2619.   		{
2620.   		pipe(fd);
2621. > 		fflush(stdout);
2622.   		fflush(stderr);
2623.   		if(fork())

apps/speed.c:2622:3: 
2620.   		pipe(fd);
2621.   		fflush(stdout);
2622. > 		fflush(stderr);
2623.   		if(fork())
2624.   			{

apps/speed.c:2623:6: Taking true branch
2621.   		fflush(stdout);
2622.   		fflush(stderr);
2623.   		if(fork())
             ^
2624.   			{
2625.   			close(fd[1]);

apps/speed.c:2625:4: 
2623.   		if(fork())
2624.   			{
2625. > 			close(fd[1]);
2626.   			fds[n]=fd[0];
2627.   			}

apps/speed.c:2626:4: 
2624.   			{
2625.   			close(fd[1]);
2626. > 			fds[n]=fd[0];
2627.   			}
2628.   		else

apps/speed.c:2639:3: 
2637.   			return 0;
2638.   			}
2639. > 		printf("Forked child %d\n",n);
2640.   		}
2641.   

apps/speed.c:2618:24: 
2616.   
2617.   	fds=malloc(multi*sizeof *fds);
2618. > 	for(n=0 ; n < multi ; ++n)
2619.   		{
2620.   		pipe(fd);

apps/speed.c:2618:12: Loop condition is false. Leaving loop
2616.   
2617.   	fds=malloc(multi*sizeof *fds);
2618.   	for(n=0 ; n < multi ; ++n)
                   ^
2619.   		{
2620.   		pipe(fd);

apps/speed.c:2643:6: 
2641.   
2642.   	/* for now, assume the pipe is long enough to take all the output */
2643. > 	for(n=0 ; n < multi ; ++n)
2644.   		{
2645.   		FILE *f;

apps/speed.c:2643:12: Loop condition is true. Entering loop body
2641.   
2642.   	/* for now, assume the pipe is long enough to take all the output */
2643.   	for(n=0 ; n < multi ; ++n)
                   ^
2644.   		{
2645.   		FILE *f;

apps/speed.c:2649:3: 
2647.   		char *p;
2648.   
2649. > 		f=fdopen(fds[n],"r");
2650.   		while(fgets(buf,sizeof buf,f))
2651.   			{

apps/speed.c:2650:9: 
2648.   
2649.   		f=fdopen(fds[n],"r");
2650. > 		while(fgets(buf,sizeof buf,f))
2651.   			{
2652.   			p=strchr(buf,'\n');
