Date: Mon, 4 May 2015 18:57:11 GMT From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r285002 - soc2013/def/crashdump-head/sbin/cryptcore Message-ID: <201505041857.t44IvBnB021843@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: def Date: Mon May 4 18:57:11 2015 New Revision: 285002 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=285002 Log: Remove file descriptor leaks. Modified: soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c Modified: soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c ============================================================================== --- soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c Mon May 4 17:59:39 2015 (r285001) +++ soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c Mon May 4 18:57:11 2015 (r285002) @@ -107,6 +107,8 @@ PJDLOG_ASSERT(input != NULL); PJDLOG_ASSERT(output != NULL); + ofd = -1; + fd = -1; privkey = RSA_new(); if (privkey == NULL) pjdlog_exitx(1, "Unable to allocate an RSA structure."); @@ -118,6 +120,7 @@ size = (int)read(fd, ciphertext, KERNELDUMP_CIPHERTEXT_SIZE); err = errno; close(fd); + fd = -1; if (size != KERNELDUMP_CIPHERTEXT_SIZE) { errno = err; pjdlog_exit(1, "Unable to read data from %s", keyfile); @@ -195,6 +198,10 @@ return; failed: + if (ofd >= 0) + close(ofd); + if (fd >= 0) + close(fd); bzero(buf, KERNELDUMP_KEY_SIZE + KERNELDUMP_IV_SIZE); EVP_CIPHER_CTX_cleanup(&ctx); RSA_free(privkey);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505041857.t44IvBnB021843>
