git.samba.org
/
ira
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
196cb6b
)
s4-messaging: fixed a memory leak in messaging_path()
author
Andrew Tridgell
<tridge@samba.org>
Fri, 8 Jan 2010 22:04:18 +0000
(09:04 +1100)
committer
Andrew Tridgell
<tridge@samba.org>
Fri, 8 Jan 2010 23:15:12 +0000
(10:15 +1100)
It is a bit convoluted to fix, as cluster_id_string() may return a
const string.
source4/lib/messaging/messaging.c
patch
|
blob
|
history
diff --git
a/source4/lib/messaging/messaging.c
b/source4/lib/messaging/messaging.c
index 277688e8b6aae96576d67e0229f3da7d158687fa..d4dfff7c8ccc23e8118b6b0570b56c0a608ec8cd 100644
(file)
--- a/
source4/lib/messaging/messaging.c
+++ b/
source4/lib/messaging/messaging.c
@@
-119,8
+119,15
@@
static NTSTATUS irpc_uptime(struct irpc_message *msg,
*/
static char *messaging_path(struct messaging_context *msg, struct server_id server_id)
{
- return talloc_asprintf(msg, "%s/msg.%s", msg->base_path,
- cluster_id_string(msg, server_id));
+ TALLOC_CTX *tmp_ctx = talloc_new(msg);
+ const char *id = cluster_id_string(tmp_ctx, server_id);
+ char *s;
+ if (id == NULL) {
+ return NULL;
+ }
+ s = talloc_asprintf(msg, "%s/msg.%s", msg->base_path, id);
+ talloc_steal(s, tmp_ctx);
+ return s;
}
/*