#1070 Possible resource leak in backup_file()
Closed: Fixed None Opened 9 years ago by sgallagh.

 55    /* try a few times to come up with a new backup file, then give up */
At conditional (3): "i < 10" taking the true branch.
 56    for (i = 0; i < 10; i++) {
At conditional (4): "i == 0" taking the false branch.
 57        if (i == 0) {
 58            dst_file = talloc_asprintf(tmp_ctx, "%s.bak", src_file);
 59        } else {
 60            dst_file = talloc_asprintf(tmp_ctx, "%s.bak%d", src_file, i);
 61        }
At conditional (5): "!dst_file" taking the false branch.
 62        if (!dst_file) {
 63            ret = ENOMEM;
 64            goto done;
 65        }
 66
 67        errno = 0;
CID 11083: Resource leak (RESOURCE_LEAK)Calling opening function "open".
Assigning: "dst_fd" = handle returned from "open(dst_file, 193, 384)".
Overwriting handle "dst_fd" in call "dst_fd = open(dst_file, 193, 384)" leaks the handle.
 68        dst_fd = open(dst_file, O_CREAT|O_EXCL|O_WRONLY, 0600);
 69        ret = errno;
 70
At conditional (1): "dst_fd > 0" taking the false branch.
Testing whether handle "dst_fd" is strictly greater than zero is suspicious. Did you intend to include equality with zero? "dst_fd" leaks when it is zero.
 71        if (dst_fd > 0) break;
 72
At conditional (2): "ret != 17" taking the false branch.
 73        if (ret != EEXIST) {
 74            DEBUG(dbglvl, ("Error (%d [%s]) opening destination file %s\n",
 75                           ret, strerror(ret), dst_file));
 76            goto done;
 77        }
 78    }

Fields changed

milestone: NEEDS_TRIAGE => SSSD 1.7.0
priority: major => minor

Fixed by 9406fc6

resolution: => fixed
status: new => closed

Fields changed

rhbz: => 0

Metadata Update from @sgallagh:
- Issue assigned to sgallagh
- Issue set to the milestone: SSSD 1.7.0

3 years ago

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/2112

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata