git.samba.org
/
ctdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d889cc4
)
ctdbd: Avoid leaking file descriptor if talloc fails
author
Amitay Isaacs
<amitay@gmail.com>
Mon, 5 Aug 2013 07:38:42 +0000
(17:38 +1000)
committer
Michael Adam
<obnox@samba.org>
Fri, 6 Jun 2014 13:00:41 +0000
(15:00 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit
d7f6bc3fed2dc61e6e587b4c0ec0ac27d533bbbe
)
server/ctdb_control.c
patch
|
blob
|
history
diff --git
a/server/ctdb_control.c
b/server/ctdb_control.c
index 0a3c7612d20ba107bb004207b42fe75cd5c35224..d98740ffd7ad3e3dc717e28211a09dcb5300db24 100644
(file)
--- a/
server/ctdb_control.c
+++ b/
server/ctdb_control.c
@@
-53,7
+53,10
@@
int32_t ctdb_dump_memory(struct ctdb_context *ctdb, TDB_DATA *outdata)
fsize = ftell(f);
rewind(f);
outdata->dptr = talloc_size(outdata, fsize);
- CTDB_NO_MEMORY(ctdb, outdata->dptr);
+ if (outdata->dptr == NULL) {
+ fclose(f);
+ CTDB_NO_MEMORY(ctdb, outdata->dptr);
+ }
outdata->dsize = fread(outdata->dptr, 1, fsize, f);
fclose(f);
if (outdata->dsize != fsize) {