commit f22539ba63f0561173c96374deda864e1fec1cee
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Jun 9 20:27:29 2011 +0200
iwhd: don't segfault upon use of uninitialized hash table pointer
* rest.c (proxy_put_attr, proxy_put_data): Initialize ms->dict.
While these two functions lack any explicit ms->dict use, they do
use it via recheck_replication.
* NEWS (Bug fixes): Mention it.
NEWS | 2 ++
rest.c | 8 ++++++++
2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9ab25a3..32ec51f 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ iwhd NEWS -*- outline
-*-
** Bug fixes
+ a query_ with a result longer than FIXME would evoke a segfault
+
the iwhd init script start function would mistakenly succeed even when
mongod failed to start in time. Now, when mongod fails to start, that
"start" function also fails.
diff --git a/rest.c b/rest.c
index 9c39673..6e6b87b 100644
--- a/rest.c
+++ b/rest.c
@@ -435,6 +435,10 @@ proxy_put_data (void *cctx, struct MHD_Connection *conn, const char
*url,
if (!ms->url) {
return MHD_NO;
}
+ ms->dict = hash_initialize(SMALL_PRIME, NULL, kv_hash,
+ kv_compare, NULL);
+ if (!ms->dict)
+ return MHD_NO;
ms->size = 0;
pipe_init_shared(&ms->pipe,ms,1);
pipe_private *pp = pipe_init_private(&ms->pipe);
@@ -631,6 +635,10 @@ proxy_put_attr (void *cctx, struct MHD_Connection *conn, const char
*url,
if (!ms->url) {
return MHD_NO;
}
+ ms->dict = hash_initialize(SMALL_PRIME, NULL, kv_hash,
+ kv_compare, NULL);
+ if (!ms->dict)
+ return MHD_NO;
attrval = MHD_lookup_connection_value(conn,MHD_HEADER_KIND,
"X-redhat-value");
if (attrval) {
Show replies by date