summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-03-08 06:36:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:11:05 -0500
commit43ad653211114ddd7c85e7d9dfe13e957a97c71d (patch)
tree3ae2fb6e7a55f7291c9b186dc3d410eb0238cca6
parentf635dcb5f3f4d65b45126a857ccd150ec0f5bed6 (diff)
downloadsamba-43ad653211114ddd7c85e7d9dfe13e957a97c71d.tar.gz
samba-43ad653211114ddd7c85e7d9dfe13e957a97c71d.tar.bz2
samba-43ad653211114ddd7c85e7d9dfe13e957a97c71d.zip
r14020: Coverity bug CID #66. Missing free on error exit.
Jeremy. (This used to be commit b9980bddf5ee74b2887196d6d1a0cf393720ba3a)
-rw-r--r--source3/lib/xfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c
index 5bb93179af..71f8bdbcbb 100644
--- a/source3/lib/xfile.c
+++ b/source3/lib/xfile.c
@@ -96,13 +96,16 @@ XFILE *x_fopen(const char *fname, int flags, mode_t mode)
XFILE *ret;
ret = SMB_MALLOC_P(XFILE);
- if (!ret) return NULL;
+ if (!ret) {
+ return NULL;
+ }
memset(ret, 0, sizeof(XFILE));
if ((flags & O_ACCMODE) == O_RDWR) {
/* we don't support RDWR in XFILE - use file
descriptors instead */
+ SAFE_FREE(ret);
errno = EINVAL;
return NULL;
}