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


apps/speed.c:2617:1: start of procedure do_multi()
2615.       }
2616.   
2617. > static int do_multi(int multi)
2618.   	{
2619.   	int n;

apps/speed.c:2622:2: 
2620.   	int fd[2];
2621.   	int *fds;
2622. > 	static char sep[]=":";
2623.   
2624.   	fds=malloc(multi*sizeof *fds);

apps/speed.c:2624:2: 
2622.   	static char sep[]=":";
2623.   
2624. > 	fds=malloc(multi*sizeof *fds);
2625.   	for(n=0 ; n < multi ; ++n)
2626.   		{

apps/speed.c:2625:6: 
2623.   
2624.   	fds=malloc(multi*sizeof *fds);
2625. > 	for(n=0 ; n < multi ; ++n)
2626.   		{
2627.   		pipe(fd);

apps/speed.c:2625:12: Loop condition is true. Entering loop body
2623.   
2624.   	fds=malloc(multi*sizeof *fds);
2625.   	for(n=0 ; n < multi ; ++n)
                   ^
2626.   		{
2627.   		pipe(fd);

apps/speed.c:2627:3: 
2625.   	for(n=0 ; n < multi ; ++n)
2626.   		{
2627. > 		pipe(fd);
2628.   		fflush(stdout);
2629.   		fflush(stderr);

apps/speed.c:2628:3: 
2626.   		{
2627.   		pipe(fd);
2628. > 		fflush(stdout);
2629.   		fflush(stderr);
2630.   		if(fork())

apps/speed.c:2629:3: 
2627.   		pipe(fd);
2628.   		fflush(stdout);
2629. > 		fflush(stderr);
2630.   		if(fork())
2631.   			{

apps/speed.c:2630:6: Taking true branch
2628.   		fflush(stdout);
2629.   		fflush(stderr);
2630.   		if(fork())
             ^
2631.   			{
2632.   			close(fd[1]);

apps/speed.c:2632:4: 
2630.   		if(fork())
2631.   			{
2632. > 			close(fd[1]);
2633.   			fds[n]=fd[0];
2634.   			}

apps/speed.c:2633:4: 
2631.   			{
2632.   			close(fd[1]);
2633. > 			fds[n]=fd[0];
2634.   			}
2635.   		else

apps/speed.c:2646:3: 
2644.   			return 0;
2645.   			}
2646. > 		printf("Forked child %d\n",n);
2647.   		}
2648.   

apps/speed.c:2625:24: 
2623.   
2624.   	fds=malloc(multi*sizeof *fds);
2625. > 	for(n=0 ; n < multi ; ++n)
2626.   		{
2627.   		pipe(fd);

apps/speed.c:2625:12: Loop condition is true. Entering loop body
2623.   
2624.   	fds=malloc(multi*sizeof *fds);
2625.   	for(n=0 ; n < multi ; ++n)
                   ^
2626.   		{
2627.   		pipe(fd);

apps/speed.c:2627:3: 
2625.   	for(n=0 ; n < multi ; ++n)
2626.   		{
2627. > 		pipe(fd);
2628.   		fflush(stdout);
2629.   		fflush(stderr);

apps/speed.c:2628:3: 
2626.   		{
2627.   		pipe(fd);
2628. > 		fflush(stdout);
2629.   		fflush(stderr);
2630.   		if(fork())

apps/speed.c:2629:3: 
2627.   		pipe(fd);
2628.   		fflush(stdout);
2629. > 		fflush(stderr);
2630.   		if(fork())
2631.   			{

apps/speed.c:2630:6: Taking true branch
2628.   		fflush(stdout);
2629.   		fflush(stderr);
2630.   		if(fork())
             ^
2631.   			{
2632.   			close(fd[1]);

apps/speed.c:2632:4: 
2630.   		if(fork())
2631.   			{
2632. > 			close(fd[1]);
2633.   			fds[n]=fd[0];
2634.   			}

apps/speed.c:2633:4: 
2631.   			{
2632.   			close(fd[1]);
2633. > 			fds[n]=fd[0];
2634.   			}
2635.   		else

apps/speed.c:2646:3: 
2644.   			return 0;
2645.   			}
2646. > 		printf("Forked child %d\n",n);
2647.   		}
2648.   

apps/speed.c:2625:24: 
2623.   
2624.   	fds=malloc(multi*sizeof *fds);
2625. > 	for(n=0 ; n < multi ; ++n)
2626.   		{
2627.   		pipe(fd);

apps/speed.c:2625:12: Loop condition is true. Entering loop body
2623.   
2624.   	fds=malloc(multi*sizeof *fds);
2625.   	for(n=0 ; n < multi ; ++n)
                   ^
2626.   		{
2627.   		pipe(fd);

apps/speed.c:2627:3: 
2625.   	for(n=0 ; n < multi ; ++n)
2626.   		{
2627. > 		pipe(fd);
2628.   		fflush(stdout);
2629.   		fflush(stderr);

apps/speed.c:2628:3: 
2626.   		{
2627.   		pipe(fd);
2628. > 		fflush(stdout);
2629.   		fflush(stderr);
2630.   		if(fork())

apps/speed.c:2629:3: 
2627.   		pipe(fd);
2628.   		fflush(stdout);
2629. > 		fflush(stderr);
2630.   		if(fork())
2631.   			{

apps/speed.c:2630:6: Taking true branch
2628.   		fflush(stdout);
2629.   		fflush(stderr);
2630.   		if(fork())
             ^
2631.   			{
2632.   			close(fd[1]);

apps/speed.c:2632:4: 
2630.   		if(fork())
2631.   			{
2632. > 			close(fd[1]);
2633.   			fds[n]=fd[0];
2634.   			}

apps/speed.c:2633:4: 
2631.   			{
2632.   			close(fd[1]);
2633. > 			fds[n]=fd[0];
2634.   			}
2635.   		else

apps/speed.c:2646:3: 
2644.   			return 0;
2645.   			}
2646. > 		printf("Forked child %d\n",n);
2647.   		}
2648.   

apps/speed.c:2625:24: 
2623.   
2624.   	fds=malloc(multi*sizeof *fds);
2625. > 	for(n=0 ; n < multi ; ++n)
2626.   		{
2627.   		pipe(fd);

apps/speed.c:2625:12: Loop condition is false. Leaving loop
2623.   
2624.   	fds=malloc(multi*sizeof *fds);
2625.   	for(n=0 ; n < multi ; ++n)
                   ^
2626.   		{
2627.   		pipe(fd);

apps/speed.c:2650:6: 
2648.   
2649.   	/* for now, assume the pipe is long enough to take all the output */
2650. > 	for(n=0 ; n < multi ; ++n)
2651.   		{
2652.   		FILE *f;

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

apps/speed.c:2656:3: 
2654.   		char *p;
2655.   
2656. > 		f=fdopen(fds[n],"r");
2657.   		while(fgets(buf,sizeof buf,f))
2658.   			{

apps/speed.c:2657:9: 
2655.   
2656.   		f=fdopen(fds[n],"r");
2657. > 		while(fgets(buf,sizeof buf,f))
2658.   			{
2659.   			p=strchr(buf,'\n');
