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


apps/speed.c:2714:1: start of procedure do_multi()
2712.       }
2713.   
2714. > static int do_multi(int multi)
2715.   	{
2716.   	int n;

apps/speed.c:2719:2: 
2717.   	int fd[2];
2718.   	int *fds;
2719. > 	static char sep[]=":";
2720.   
2721.   	fds=malloc(multi*sizeof *fds);

apps/speed.c:2721:2: 
2719.   	static char sep[]=":";
2720.   
2721. > 	fds=malloc(multi*sizeof *fds);
2722.   	for(n=0 ; n < multi ; ++n)
2723.   		{

apps/speed.c:2722:6: 
2720.   
2721.   	fds=malloc(multi*sizeof *fds);
2722. > 	for(n=0 ; n < multi ; ++n)
2723.   		{
2724.   		if (pipe(fd) == -1)

apps/speed.c:2722:12: Loop condition is true. Entering loop body
2720.   
2721.   	fds=malloc(multi*sizeof *fds);
2722.   	for(n=0 ; n < multi ; ++n)
                   ^
2723.   		{
2724.   		if (pipe(fd) == -1)

apps/speed.c:2724:7: Taking false branch
2722.   	for(n=0 ; n < multi ; ++n)
2723.   		{
2724.   		if (pipe(fd) == -1)
              ^
2725.   			{
2726.   			fprintf(stderr, "pipe failure\n");

apps/speed.c:2729:3: 
2727.   			exit(1);
2728.   			}
2729. > 		fflush(stdout);
2730.   		fflush(stderr);
2731.   		if(fork())

apps/speed.c:2730:3: 
2728.   			}
2729.   		fflush(stdout);
2730. > 		fflush(stderr);
2731.   		if(fork())
2732.   			{

apps/speed.c:2731:6: Taking true branch
2729.   		fflush(stdout);
2730.   		fflush(stderr);
2731.   		if(fork())
             ^
2732.   			{
2733.   			close(fd[1]);

apps/speed.c:2733:4: 
2731.   		if(fork())
2732.   			{
2733. > 			close(fd[1]);
2734.   			fds[n]=fd[0];
2735.   			}

apps/speed.c:2734:4: 
2732.   			{
2733.   			close(fd[1]);
2734. > 			fds[n]=fd[0];
2735.   			}
2736.   		else

apps/speed.c:2751:3: 
2749.   			return 0;
2750.   			}
2751. > 		printf("Forked child %d\n",n);
2752.   		}
2753.   

apps/speed.c:2722:24: 
2720.   
2721.   	fds=malloc(multi*sizeof *fds);
2722. > 	for(n=0 ; n < multi ; ++n)
2723.   		{
2724.   		if (pipe(fd) == -1)

apps/speed.c:2722:12: Loop condition is true. Entering loop body
2720.   
2721.   	fds=malloc(multi*sizeof *fds);
2722.   	for(n=0 ; n < multi ; ++n)
                   ^
2723.   		{
2724.   		if (pipe(fd) == -1)

apps/speed.c:2724:7: Taking false branch
2722.   	for(n=0 ; n < multi ; ++n)
2723.   		{
2724.   		if (pipe(fd) == -1)
              ^
2725.   			{
2726.   			fprintf(stderr, "pipe failure\n");

apps/speed.c:2729:3: 
2727.   			exit(1);
2728.   			}
2729. > 		fflush(stdout);
2730.   		fflush(stderr);
2731.   		if(fork())

apps/speed.c:2730:3: 
2728.   			}
2729.   		fflush(stdout);
2730. > 		fflush(stderr);
2731.   		if(fork())
2732.   			{

apps/speed.c:2731:6: Taking true branch
2729.   		fflush(stdout);
2730.   		fflush(stderr);
2731.   		if(fork())
             ^
2732.   			{
2733.   			close(fd[1]);

apps/speed.c:2733:4: 
2731.   		if(fork())
2732.   			{
2733. > 			close(fd[1]);
2734.   			fds[n]=fd[0];
2735.   			}

apps/speed.c:2734:4: 
2732.   			{
2733.   			close(fd[1]);
2734. > 			fds[n]=fd[0];
2735.   			}
2736.   		else

apps/speed.c:2751:3: 
2749.   			return 0;
2750.   			}
2751. > 		printf("Forked child %d\n",n);
2752.   		}
2753.   

apps/speed.c:2722:24: 
2720.   
2721.   	fds=malloc(multi*sizeof *fds);
2722. > 	for(n=0 ; n < multi ; ++n)
2723.   		{
2724.   		if (pipe(fd) == -1)

apps/speed.c:2722:12: Loop condition is true. Entering loop body
2720.   
2721.   	fds=malloc(multi*sizeof *fds);
2722.   	for(n=0 ; n < multi ; ++n)
                   ^
2723.   		{
2724.   		if (pipe(fd) == -1)

apps/speed.c:2724:7: Taking false branch
2722.   	for(n=0 ; n < multi ; ++n)
2723.   		{
2724.   		if (pipe(fd) == -1)
              ^
2725.   			{
2726.   			fprintf(stderr, "pipe failure\n");

apps/speed.c:2729:3: 
2727.   			exit(1);
2728.   			}
2729. > 		fflush(stdout);
2730.   		fflush(stderr);
2731.   		if(fork())

apps/speed.c:2730:3: 
2728.   			}
2729.   		fflush(stdout);
2730. > 		fflush(stderr);
2731.   		if(fork())
2732.   			{

apps/speed.c:2731:6: Taking true branch
2729.   		fflush(stdout);
2730.   		fflush(stderr);
2731.   		if(fork())
             ^
2732.   			{
2733.   			close(fd[1]);

apps/speed.c:2733:4: 
2731.   		if(fork())
2732.   			{
2733. > 			close(fd[1]);
2734.   			fds[n]=fd[0];
2735.   			}

apps/speed.c:2734:4: 
2732.   			{
2733.   			close(fd[1]);
2734. > 			fds[n]=fd[0];
2735.   			}
2736.   		else

apps/speed.c:2751:3: 
2749.   			return 0;
2750.   			}
2751. > 		printf("Forked child %d\n",n);
2752.   		}
2753.   

apps/speed.c:2722:24: 
2720.   
2721.   	fds=malloc(multi*sizeof *fds);
2722. > 	for(n=0 ; n < multi ; ++n)
2723.   		{
2724.   		if (pipe(fd) == -1)

apps/speed.c:2722:12: Loop condition is false. Leaving loop
2720.   
2721.   	fds=malloc(multi*sizeof *fds);
2722.   	for(n=0 ; n < multi ; ++n)
                   ^
2723.   		{
2724.   		if (pipe(fd) == -1)

apps/speed.c:2755:6: 
2753.   
2754.   	/* for now, assume the pipe is long enough to take all the output */
2755. > 	for(n=0 ; n < multi ; ++n)
2756.   		{
2757.   		FILE *f;

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

apps/speed.c:2761:3: 
2759.   		char *p;
2760.   
2761. > 		f=fdopen(fds[n],"r");
2762.   		while(fgets(buf,sizeof buf,f))
2763.   			{

apps/speed.c:2762:9: 
2760.   
2761.   		f=fdopen(fds[n],"r");
2762. > 		while(fgets(buf,sizeof buf,f))
2763.   			{
2764.   			p=strchr(buf,'\n');
