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


apps/speed.c:2273:1: start of procedure do_multi()
2271.   }
2272.   
2273. > static int do_multi(int multi)
2274.   {
2275.       int n;

apps/speed.c:2278:5: 
2276.       int fd[2];
2277.       int *fds;
2278. >     static char sep[] = ":";
2279.   
2280.       fds = malloc(sizeof(*fds) * multi);

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

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

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

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

apps/speed.c:2286:9: 
2284.               exit(1);
2285.           }
2286. >         fflush(stdout);
2287.           (void)BIO_flush(bio_err);
2288.           if (fork()) {

apps/speed.c:2287:15: 
2285.           }
2286.           fflush(stdout);
2287. >         (void)BIO_flush(bio_err);
2288.           if (fork()) {
2289.               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:2287:9: 
2285.           }
2286.           fflush(stdout);
2287. >         (void)BIO_flush(bio_err);
2288.           if (fork()) {
2289.               close(fd[1]);

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

apps/speed.c:2289:13: 
2287.           (void)BIO_flush(bio_err);
2288.           if (fork()) {
2289. >             close(fd[1]);
2290.               fds[n] = fd[0];
2291.           } else {

apps/speed.c:2290:13: 
2288.           if (fork()) {
2289.               close(fd[1]);
2290. >             fds[n] = fd[0];
2291.           } else {
2292.               close(fd[0]);

apps/speed.c:2304:9: 
2302.               return 0;
2303.           }
2304. >         printf("Forked child %d\n", n);
2305.       }
2306.   

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

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

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

apps/speed.c:2286:9: 
2284.               exit(1);
2285.           }
2286. >         fflush(stdout);
2287.           (void)BIO_flush(bio_err);
2288.           if (fork()) {

apps/speed.c:2287:15: 
2285.           }
2286.           fflush(stdout);
2287. >         (void)BIO_flush(bio_err);
2288.           if (fork()) {
2289.               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:2287:9: 
2285.           }
2286.           fflush(stdout);
2287. >         (void)BIO_flush(bio_err);
2288.           if (fork()) {
2289.               close(fd[1]);

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

apps/speed.c:2289:13: 
2287.           (void)BIO_flush(bio_err);
2288.           if (fork()) {
2289. >             close(fd[1]);
2290.               fds[n] = fd[0];
2291.           } else {

apps/speed.c:2290:13: 
2288.           if (fork()) {
2289.               close(fd[1]);
2290. >             fds[n] = fd[0];
2291.           } else {
2292.               close(fd[0]);

apps/speed.c:2304:9: 
2302.               return 0;
2303.           }
2304. >         printf("Forked child %d\n", n);
2305.       }
2306.   

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

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

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

apps/speed.c:2286:9: 
2284.               exit(1);
2285.           }
2286. >         fflush(stdout);
2287.           (void)BIO_flush(bio_err);
2288.           if (fork()) {

apps/speed.c:2287:15: 
2285.           }
2286.           fflush(stdout);
2287. >         (void)BIO_flush(bio_err);
2288.           if (fork()) {
2289.               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:2287:9: 
2285.           }
2286.           fflush(stdout);
2287. >         (void)BIO_flush(bio_err);
2288.           if (fork()) {
2289.               close(fd[1]);

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

apps/speed.c:2289:13: 
2287.           (void)BIO_flush(bio_err);
2288.           if (fork()) {
2289. >             close(fd[1]);
2290.               fds[n] = fd[0];
2291.           } else {

apps/speed.c:2290:13: 
2288.           if (fork()) {
2289.               close(fd[1]);
2290. >             fds[n] = fd[0];
2291.           } else {
2292.               close(fd[0]);

apps/speed.c:2304:9: 
2302.               return 0;
2303.           }
2304. >         printf("Forked child %d\n", n);
2305.       }
2306.   

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

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

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

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

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

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