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


apps/speed.c:2593:1: start of procedure do_multi()
2591.       }
2592.   
2593. > static int do_multi(int multi)
2594.   	{
2595.   	int n;

apps/speed.c:2598:2: 
2596.   	int fd[2];
2597.   	int *fds;
2598. > 	static char sep[]=":";
2599.   
2600.   	fds=malloc(multi*sizeof *fds);

apps/speed.c:2600:2: 
2598.   	static char sep[]=":";
2599.   
2600. > 	fds=malloc(multi*sizeof *fds);
2601.   	for(n=0 ; n < multi ; ++n)
2602.   		{

apps/speed.c:2601:6: 
2599.   
2600.   	fds=malloc(multi*sizeof *fds);
2601. > 	for(n=0 ; n < multi ; ++n)
2602.   		{
2603.   		pipe(fd);

apps/speed.c:2601:12: Loop condition is true. Entering loop body
2599.   
2600.   	fds=malloc(multi*sizeof *fds);
2601.   	for(n=0 ; n < multi ; ++n)
                   ^
2602.   		{
2603.   		pipe(fd);

apps/speed.c:2603:3: 
2601.   	for(n=0 ; n < multi ; ++n)
2602.   		{
2603. > 		pipe(fd);
2604.   		fflush(stdout);
2605.   		fflush(stderr);

apps/speed.c:2604:3: 
2602.   		{
2603.   		pipe(fd);
2604. > 		fflush(stdout);
2605.   		fflush(stderr);
2606.   		if(fork())

apps/speed.c:2605:3: 
2603.   		pipe(fd);
2604.   		fflush(stdout);
2605. > 		fflush(stderr);
2606.   		if(fork())
2607.   			{

apps/speed.c:2606:6: Taking true branch
2604.   		fflush(stdout);
2605.   		fflush(stderr);
2606.   		if(fork())
             ^
2607.   			{
2608.   			close(fd[1]);

apps/speed.c:2608:4: 
2606.   		if(fork())
2607.   			{
2608. > 			close(fd[1]);
2609.   			fds[n]=fd[0];
2610.   			}

apps/speed.c:2609:4: 
2607.   			{
2608.   			close(fd[1]);
2609. > 			fds[n]=fd[0];
2610.   			}
2611.   		else

apps/speed.c:2622:3: 
2620.   			return 0;
2621.   			}
2622. > 		printf("Forked child %d\n",n);
2623.   		}
2624.   

apps/speed.c:2601:24: 
2599.   
2600.   	fds=malloc(multi*sizeof *fds);
2601. > 	for(n=0 ; n < multi ; ++n)
2602.   		{
2603.   		pipe(fd);

apps/speed.c:2601:12: Loop condition is true. Entering loop body
2599.   
2600.   	fds=malloc(multi*sizeof *fds);
2601.   	for(n=0 ; n < multi ; ++n)
                   ^
2602.   		{
2603.   		pipe(fd);

apps/speed.c:2603:3: 
2601.   	for(n=0 ; n < multi ; ++n)
2602.   		{
2603. > 		pipe(fd);
2604.   		fflush(stdout);
2605.   		fflush(stderr);

apps/speed.c:2604:3: 
2602.   		{
2603.   		pipe(fd);
2604. > 		fflush(stdout);
2605.   		fflush(stderr);
2606.   		if(fork())

apps/speed.c:2605:3: 
2603.   		pipe(fd);
2604.   		fflush(stdout);
2605. > 		fflush(stderr);
2606.   		if(fork())
2607.   			{

apps/speed.c:2606:6: Taking true branch
2604.   		fflush(stdout);
2605.   		fflush(stderr);
2606.   		if(fork())
             ^
2607.   			{
2608.   			close(fd[1]);

apps/speed.c:2608:4: 
2606.   		if(fork())
2607.   			{
2608. > 			close(fd[1]);
2609.   			fds[n]=fd[0];
2610.   			}

apps/speed.c:2609:4: 
2607.   			{
2608.   			close(fd[1]);
2609. > 			fds[n]=fd[0];
2610.   			}
2611.   		else

apps/speed.c:2622:3: 
2620.   			return 0;
2621.   			}
2622. > 		printf("Forked child %d\n",n);
2623.   		}
2624.   

apps/speed.c:2601:24: 
2599.   
2600.   	fds=malloc(multi*sizeof *fds);
2601. > 	for(n=0 ; n < multi ; ++n)
2602.   		{
2603.   		pipe(fd);

apps/speed.c:2601:12: Loop condition is true. Entering loop body
2599.   
2600.   	fds=malloc(multi*sizeof *fds);
2601.   	for(n=0 ; n < multi ; ++n)
                   ^
2602.   		{
2603.   		pipe(fd);

apps/speed.c:2603:3: 
2601.   	for(n=0 ; n < multi ; ++n)
2602.   		{
2603. > 		pipe(fd);
2604.   		fflush(stdout);
2605.   		fflush(stderr);

apps/speed.c:2604:3: 
2602.   		{
2603.   		pipe(fd);
2604. > 		fflush(stdout);
2605.   		fflush(stderr);
2606.   		if(fork())

apps/speed.c:2605:3: 
2603.   		pipe(fd);
2604.   		fflush(stdout);
2605. > 		fflush(stderr);
2606.   		if(fork())
2607.   			{

apps/speed.c:2606:6: Taking true branch
2604.   		fflush(stdout);
2605.   		fflush(stderr);
2606.   		if(fork())
             ^
2607.   			{
2608.   			close(fd[1]);

apps/speed.c:2608:4: 
2606.   		if(fork())
2607.   			{
2608. > 			close(fd[1]);
2609.   			fds[n]=fd[0];
2610.   			}

apps/speed.c:2609:4: 
2607.   			{
2608.   			close(fd[1]);
2609. > 			fds[n]=fd[0];
2610.   			}
2611.   		else

apps/speed.c:2622:3: 
2620.   			return 0;
2621.   			}
2622. > 		printf("Forked child %d\n",n);
2623.   		}
2624.   

apps/speed.c:2601:24: 
2599.   
2600.   	fds=malloc(multi*sizeof *fds);
2601. > 	for(n=0 ; n < multi ; ++n)
2602.   		{
2603.   		pipe(fd);

apps/speed.c:2601:12: Loop condition is false. Leaving loop
2599.   
2600.   	fds=malloc(multi*sizeof *fds);
2601.   	for(n=0 ; n < multi ; ++n)
                   ^
2602.   		{
2603.   		pipe(fd);

apps/speed.c:2626:6: 
2624.   
2625.   	/* for now, assume the pipe is long enough to take all the output */
2626. > 	for(n=0 ; n < multi ; ++n)
2627.   		{
2628.   		FILE *f;

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

apps/speed.c:2632:3: 
2630.   		char *p;
2631.   
2632. > 		f=fdopen(fds[n],"r");
2633.   		while(fgets(buf,sizeof buf,f))
2634.   			{

apps/speed.c:2633:9: 
2631.   
2632.   		f=fdopen(fds[n],"r");
2633. > 		while(fgets(buf,sizeof buf,f))
2634.   			{
2635.   			p=strchr(buf,'\n');
