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


apps/speed.c:2277:1: start of procedure do_multi()
2275.   }
2276.   
2277. > static int do_multi(int multi)
2278.   {
2279.       int n;

apps/speed.c:2282:5: 
2280.       int fd[2];
2281.       int *fds;
2282. >     static char sep[] = ":";
2283.   
2284.       fds = malloc(sizeof(*fds) * multi);

apps/speed.c:2284:5: 
2282.       static char sep[] = ":";
2283.   
2284. >     fds = malloc(sizeof(*fds) * multi);
2285.       for (n = 0; n < multi; ++n) {
2286.           if (pipe(fd) == -1) {

apps/speed.c:2285:10: 
2283.   
2284.       fds = malloc(sizeof(*fds) * multi);
2285. >     for (n = 0; n < multi; ++n) {
2286.           if (pipe(fd) == -1) {
2287.               BIO_printf(bio_err, "pipe failure\n");

apps/speed.c:2285:17: Loop condition is true. Entering loop body
2283.   
2284.       fds = malloc(sizeof(*fds) * multi);
2285.       for (n = 0; n < multi; ++n) {
                        ^
2286.           if (pipe(fd) == -1) {
2287.               BIO_printf(bio_err, "pipe failure\n");

apps/speed.c:2286:13: Taking false branch
2284.       fds = malloc(sizeof(*fds) * multi);
2285.       for (n = 0; n < multi; ++n) {
2286.           if (pipe(fd) == -1) {
                    ^
2287.               BIO_printf(bio_err, "pipe failure\n");
2288.               exit(1);

apps/speed.c:2290:9: 
2288.               exit(1);
2289.           }
2290. >         fflush(stdout);
2291.           (void)BIO_flush(bio_err);
2292.           if (fork()) {

apps/speed.c:2291:15: 
2289.           }
2290.           fflush(stdout);
2291. >         (void)BIO_flush(bio_err);
2292.           if (fork()) {
2293.               close(fd[1]);

crypto/bio/bio_lib.c:339:1: start of procedure BIO_ctrl()
  337.   }
  338.   
  339. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
  340.   {
  341.       long ret;

crypto/bio/bio_lib.c:344:9: Taking true branch
  342.       long (*cb) (BIO *, int, const char *, int, long, long);
  343.   
  344.       if (b == NULL)
                 ^
  345.           return (0);
  346.   

crypto/bio/bio_lib.c:345:9: 
  343.   
  344.       if (b == NULL)
  345. >         return (0);
  346.   
  347.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {

crypto/bio/bio_lib.c:363:1: return from a call to BIO_ctrl
  361.           ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret);
  362.       return (ret);
  363. > }
  364.   
  365.   long BIO_callback_ctrl(BIO *b, int cmd,

apps/speed.c:2291:9: 
2289.           }
2290.           fflush(stdout);
2291. >         (void)BIO_flush(bio_err);
2292.           if (fork()) {
2293.               close(fd[1]);

apps/speed.c:2292:13: Taking true branch
2290.           fflush(stdout);
2291.           (void)BIO_flush(bio_err);
2292.           if (fork()) {
                    ^
2293.               close(fd[1]);
2294.               fds[n] = fd[0];

apps/speed.c:2293:13: 
2291.           (void)BIO_flush(bio_err);
2292.           if (fork()) {
2293. >             close(fd[1]);
2294.               fds[n] = fd[0];
2295.           } else {

apps/speed.c:2294:13: 
2292.           if (fork()) {
2293.               close(fd[1]);
2294. >             fds[n] = fd[0];
2295.           } else {
2296.               close(fd[0]);

apps/speed.c:2308:9: 
2306.               return 0;
2307.           }
2308. >         printf("Forked child %d\n", n);
2309.       }
2310.   

apps/speed.c:2285:28: 
2283.   
2284.       fds = malloc(sizeof(*fds) * multi);
2285. >     for (n = 0; n < multi; ++n) {
2286.           if (pipe(fd) == -1) {
2287.               BIO_printf(bio_err, "pipe failure\n");

apps/speed.c:2285:17: Loop condition is true. Entering loop body
2283.   
2284.       fds = malloc(sizeof(*fds) * multi);
2285.       for (n = 0; n < multi; ++n) {
                        ^
2286.           if (pipe(fd) == -1) {
2287.               BIO_printf(bio_err, "pipe failure\n");

apps/speed.c:2286:13: Taking false branch
2284.       fds = malloc(sizeof(*fds) * multi);
2285.       for (n = 0; n < multi; ++n) {
2286.           if (pipe(fd) == -1) {
                    ^
2287.               BIO_printf(bio_err, "pipe failure\n");
2288.               exit(1);

apps/speed.c:2290:9: 
2288.               exit(1);
2289.           }
2290. >         fflush(stdout);
2291.           (void)BIO_flush(bio_err);
2292.           if (fork()) {

apps/speed.c:2291:15: 
2289.           }
2290.           fflush(stdout);
2291. >         (void)BIO_flush(bio_err);
2292.           if (fork()) {
2293.               close(fd[1]);

crypto/bio/bio_lib.c:339:1: start of procedure BIO_ctrl()
  337.   }
  338.   
  339. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
  340.   {
  341.       long ret;

crypto/bio/bio_lib.c:344:9: Taking true branch
  342.       long (*cb) (BIO *, int, const char *, int, long, long);
  343.   
  344.       if (b == NULL)
                 ^
  345.           return (0);
  346.   

crypto/bio/bio_lib.c:345:9: 
  343.   
  344.       if (b == NULL)
  345. >         return (0);
  346.   
  347.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {

crypto/bio/bio_lib.c:363:1: return from a call to BIO_ctrl
  361.           ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret);
  362.       return (ret);
  363. > }
  364.   
  365.   long BIO_callback_ctrl(BIO *b, int cmd,

apps/speed.c:2291:9: 
2289.           }
2290.           fflush(stdout);
2291. >         (void)BIO_flush(bio_err);
2292.           if (fork()) {
2293.               close(fd[1]);

apps/speed.c:2292:13: Taking true branch
2290.           fflush(stdout);
2291.           (void)BIO_flush(bio_err);
2292.           if (fork()) {
                    ^
2293.               close(fd[1]);
2294.               fds[n] = fd[0];

apps/speed.c:2293:13: 
2291.           (void)BIO_flush(bio_err);
2292.           if (fork()) {
2293. >             close(fd[1]);
2294.               fds[n] = fd[0];
2295.           } else {

apps/speed.c:2294:13: 
2292.           if (fork()) {
2293.               close(fd[1]);
2294. >             fds[n] = fd[0];
2295.           } else {
2296.               close(fd[0]);

apps/speed.c:2308:9: 
2306.               return 0;
2307.           }
2308. >         printf("Forked child %d\n", n);
2309.       }
2310.   

apps/speed.c:2285:28: 
2283.   
2284.       fds = malloc(sizeof(*fds) * multi);
2285. >     for (n = 0; n < multi; ++n) {
2286.           if (pipe(fd) == -1) {
2287.               BIO_printf(bio_err, "pipe failure\n");

apps/speed.c:2285:17: Loop condition is true. Entering loop body
2283.   
2284.       fds = malloc(sizeof(*fds) * multi);
2285.       for (n = 0; n < multi; ++n) {
                        ^
2286.           if (pipe(fd) == -1) {
2287.               BIO_printf(bio_err, "pipe failure\n");

apps/speed.c:2286:13: Taking false branch
2284.       fds = malloc(sizeof(*fds) * multi);
2285.       for (n = 0; n < multi; ++n) {
2286.           if (pipe(fd) == -1) {
                    ^
2287.               BIO_printf(bio_err, "pipe failure\n");
2288.               exit(1);

apps/speed.c:2290:9: 
2288.               exit(1);
2289.           }
2290. >         fflush(stdout);
2291.           (void)BIO_flush(bio_err);
2292.           if (fork()) {

apps/speed.c:2291:15: 
2289.           }
2290.           fflush(stdout);
2291. >         (void)BIO_flush(bio_err);
2292.           if (fork()) {
2293.               close(fd[1]);

crypto/bio/bio_lib.c:339:1: start of procedure BIO_ctrl()
  337.   }
  338.   
  339. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
  340.   {
  341.       long ret;

crypto/bio/bio_lib.c:344:9: Taking true branch
  342.       long (*cb) (BIO *, int, const char *, int, long, long);
  343.   
  344.       if (b == NULL)
                 ^
  345.           return (0);
  346.   

crypto/bio/bio_lib.c:345:9: 
  343.   
  344.       if (b == NULL)
  345. >         return (0);
  346.   
  347.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {

crypto/bio/bio_lib.c:363:1: return from a call to BIO_ctrl
  361.           ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret);
  362.       return (ret);
  363. > }
  364.   
  365.   long BIO_callback_ctrl(BIO *b, int cmd,

apps/speed.c:2291:9: 
2289.           }
2290.           fflush(stdout);
2291. >         (void)BIO_flush(bio_err);
2292.           if (fork()) {
2293.               close(fd[1]);

apps/speed.c:2292:13: Taking true branch
2290.           fflush(stdout);
2291.           (void)BIO_flush(bio_err);
2292.           if (fork()) {
                    ^
2293.               close(fd[1]);
2294.               fds[n] = fd[0];

apps/speed.c:2293:13: 
2291.           (void)BIO_flush(bio_err);
2292.           if (fork()) {
2293. >             close(fd[1]);
2294.               fds[n] = fd[0];
2295.           } else {

apps/speed.c:2294:13: 
2292.           if (fork()) {
2293.               close(fd[1]);
2294. >             fds[n] = fd[0];
2295.           } else {
2296.               close(fd[0]);

apps/speed.c:2308:9: 
2306.               return 0;
2307.           }
2308. >         printf("Forked child %d\n", n);
2309.       }
2310.   

apps/speed.c:2285:28: 
2283.   
2284.       fds = malloc(sizeof(*fds) * multi);
2285. >     for (n = 0; n < multi; ++n) {
2286.           if (pipe(fd) == -1) {
2287.               BIO_printf(bio_err, "pipe failure\n");

apps/speed.c:2285:17: Loop condition is false. Leaving loop
2283.   
2284.       fds = malloc(sizeof(*fds) * multi);
2285.       for (n = 0; n < multi; ++n) {
                        ^
2286.           if (pipe(fd) == -1) {
2287.               BIO_printf(bio_err, "pipe failure\n");

apps/speed.c:2312:10: 
2310.   
2311.       /* for now, assume the pipe is long enough to take all the output */
2312. >     for (n = 0; n < multi; ++n) {
2313.           FILE *f;
2314.           char buf[1024];

apps/speed.c:2312:17: Loop condition is true. Entering loop body
2310.   
2311.       /* for now, assume the pipe is long enough to take all the output */
2312.       for (n = 0; n < multi; ++n) {
                        ^
2313.           FILE *f;
2314.           char buf[1024];

apps/speed.c:2317:9: 
2315.           char *p;
2316.   
2317. >         f = fdopen(fds[n], "r");
2318.           while (fgets(buf, sizeof buf, f)) {
2319.               p = strchr(buf, '\n');

apps/speed.c:2318:16: 
2316.   
2317.           f = fdopen(fds[n], "r");
2318. >         while (fgets(buf, sizeof buf, f)) {
2319.               p = strchr(buf, '\n');
2320.               if (p)
