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


apps/speed.c:2585:1: start of procedure do_multi()
2583.       }
2584.   
2585. > static int do_multi(int multi)
2586.   	{
2587.   	int n;

apps/speed.c:2590:2: 
2588.   	int fd[2];
2589.   	int *fds;
2590. > 	static char sep[]=":";
2591.   
2592.   	fds=malloc(multi*sizeof *fds);

apps/speed.c:2592:2: 
2590.   	static char sep[]=":";
2591.   
2592. > 	fds=malloc(multi*sizeof *fds);
2593.   	for(n=0 ; n < multi ; ++n)
2594.   		{

apps/speed.c:2593:6: 
2591.   
2592.   	fds=malloc(multi*sizeof *fds);
2593. > 	for(n=0 ; n < multi ; ++n)
2594.   		{
2595.   		pipe(fd);

apps/speed.c:2593:12: Loop condition is true. Entering loop body
2591.   
2592.   	fds=malloc(multi*sizeof *fds);
2593.   	for(n=0 ; n < multi ; ++n)
                   ^
2594.   		{
2595.   		pipe(fd);

apps/speed.c:2595:3: 
2593.   	for(n=0 ; n < multi ; ++n)
2594.   		{
2595. > 		pipe(fd);
2596.   		fflush(stdout);
2597.   		fflush(stderr);

apps/speed.c:2596:3: 
2594.   		{
2595.   		pipe(fd);
2596. > 		fflush(stdout);
2597.   		fflush(stderr);
2598.   		if(fork())

apps/speed.c:2597:3: 
2595.   		pipe(fd);
2596.   		fflush(stdout);
2597. > 		fflush(stderr);
2598.   		if(fork())
2599.   			{

apps/speed.c:2598:6: Taking true branch
2596.   		fflush(stdout);
2597.   		fflush(stderr);
2598.   		if(fork())
             ^
2599.   			{
2600.   			close(fd[1]);

apps/speed.c:2600:4: 
2598.   		if(fork())
2599.   			{
2600. > 			close(fd[1]);
2601.   			fds[n]=fd[0];
2602.   			}

apps/speed.c:2601:4: 
2599.   			{
2600.   			close(fd[1]);
2601. > 			fds[n]=fd[0];
2602.   			}
2603.   		else

apps/speed.c:2614:3: 
2612.   			return 0;
2613.   			}
2614. > 		printf("Forked child %d\n",n);
2615.   		}
2616.   

apps/speed.c:2593:24: 
2591.   
2592.   	fds=malloc(multi*sizeof *fds);
2593. > 	for(n=0 ; n < multi ; ++n)
2594.   		{
2595.   		pipe(fd);

apps/speed.c:2593:12: Loop condition is true. Entering loop body
2591.   
2592.   	fds=malloc(multi*sizeof *fds);
2593.   	for(n=0 ; n < multi ; ++n)
                   ^
2594.   		{
2595.   		pipe(fd);

apps/speed.c:2595:3: 
2593.   	for(n=0 ; n < multi ; ++n)
2594.   		{
2595. > 		pipe(fd);
2596.   		fflush(stdout);
2597.   		fflush(stderr);

apps/speed.c:2596:3: 
2594.   		{
2595.   		pipe(fd);
2596. > 		fflush(stdout);
2597.   		fflush(stderr);
2598.   		if(fork())

apps/speed.c:2597:3: 
2595.   		pipe(fd);
2596.   		fflush(stdout);
2597. > 		fflush(stderr);
2598.   		if(fork())
2599.   			{

apps/speed.c:2598:6: Taking true branch
2596.   		fflush(stdout);
2597.   		fflush(stderr);
2598.   		if(fork())
             ^
2599.   			{
2600.   			close(fd[1]);

apps/speed.c:2600:4: 
2598.   		if(fork())
2599.   			{
2600. > 			close(fd[1]);
2601.   			fds[n]=fd[0];
2602.   			}

apps/speed.c:2601:4: 
2599.   			{
2600.   			close(fd[1]);
2601. > 			fds[n]=fd[0];
2602.   			}
2603.   		else

apps/speed.c:2614:3: 
2612.   			return 0;
2613.   			}
2614. > 		printf("Forked child %d\n",n);
2615.   		}
2616.   

apps/speed.c:2593:24: 
2591.   
2592.   	fds=malloc(multi*sizeof *fds);
2593. > 	for(n=0 ; n < multi ; ++n)
2594.   		{
2595.   		pipe(fd);

apps/speed.c:2593:12: Loop condition is true. Entering loop body
2591.   
2592.   	fds=malloc(multi*sizeof *fds);
2593.   	for(n=0 ; n < multi ; ++n)
                   ^
2594.   		{
2595.   		pipe(fd);

apps/speed.c:2595:3: 
2593.   	for(n=0 ; n < multi ; ++n)
2594.   		{
2595. > 		pipe(fd);
2596.   		fflush(stdout);
2597.   		fflush(stderr);

apps/speed.c:2596:3: 
2594.   		{
2595.   		pipe(fd);
2596. > 		fflush(stdout);
2597.   		fflush(stderr);
2598.   		if(fork())

apps/speed.c:2597:3: 
2595.   		pipe(fd);
2596.   		fflush(stdout);
2597. > 		fflush(stderr);
2598.   		if(fork())
2599.   			{

apps/speed.c:2598:6: Taking true branch
2596.   		fflush(stdout);
2597.   		fflush(stderr);
2598.   		if(fork())
             ^
2599.   			{
2600.   			close(fd[1]);

apps/speed.c:2600:4: 
2598.   		if(fork())
2599.   			{
2600. > 			close(fd[1]);
2601.   			fds[n]=fd[0];
2602.   			}

apps/speed.c:2601:4: 
2599.   			{
2600.   			close(fd[1]);
2601. > 			fds[n]=fd[0];
2602.   			}
2603.   		else

apps/speed.c:2614:3: 
2612.   			return 0;
2613.   			}
2614. > 		printf("Forked child %d\n",n);
2615.   		}
2616.   

apps/speed.c:2593:24: 
2591.   
2592.   	fds=malloc(multi*sizeof *fds);
2593. > 	for(n=0 ; n < multi ; ++n)
2594.   		{
2595.   		pipe(fd);

apps/speed.c:2593:12: Loop condition is false. Leaving loop
2591.   
2592.   	fds=malloc(multi*sizeof *fds);
2593.   	for(n=0 ; n < multi ; ++n)
                   ^
2594.   		{
2595.   		pipe(fd);

apps/speed.c:2618:6: 
2616.   
2617.   	/* for now, assume the pipe is long enough to take all the output */
2618. > 	for(n=0 ; n < multi ; ++n)
2619.   		{
2620.   		FILE *f;

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

apps/speed.c:2624:3: 
2622.   		char *p;
2623.   
2624. > 		f=fdopen(fds[n],"r");
2625.   		while(fgets(buf,sizeof buf,f))
2626.   			{

apps/speed.c:2625:9: 
2623.   
2624.   		f=fdopen(fds[n],"r");
2625. > 		while(fgets(buf,sizeof buf,f))
2626.   			{
2627.   			p=strchr(buf,'\n');
