Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-2651

Coverity 1355591 resource leak

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • WT2.9.0, 3.3.8
    • Affects Version/s: None
    • Component/s: None
    • None

      wtperf/confi.c

                   if (*strp == NULL)
         	10. alloc_fn: Storage is returned from allocation function dstrdup. [show details]
         	11. var_assign: Assigning: newstr = storage returned from dstrdup(v->str).
         	12. var_assign: Assigning: begin = newstr.
         	13. Falling through to end of if statement
      490                        begin = newstr = dstrdup(v->str);
      491                else {
      492                        newlen += (strlen(*strp) + 1);
      493                        newstr = dcalloc(newlen, sizeof(char));
      494                        snprintf(newstr, newlen,
      495                            "%s,%*s", *strp, (int)v->len, v->str);
      496                        /* Free the old value now we've copied it. */
      497                        free(*strp);
      498                        begin = &newstr[newlen - 1 - v->len];
      499                }
         	14. noescape: Resource begin is not freed or pointed-to in config_unescape. [show details]
         	15. Condition (ret = config_unescape(begin)) != 0, taking true branch
      500                if ((ret = config_unescape(begin)) != 0)
         	16. leaked_storage: Variable newstr going out of scope leaks the storage it points to.
         	
      CID 1355591 (#2-1 of 2): Resource leak (RESOURCE_LEAK)
      17. leaked_storage: Variable begin going out of scope leaks the storage it points to.
      501                        return (ret);
      

            Assignee:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Reporter:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: