>From aed01fa24688257fdf6f3c5ecf6983f61b8749f8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyer...@redhat.com>
Date: Thu, 23 Sep 2010 11:12:27 +0200
Subject: [PATCH tabled] server/status.c: don't deref NULL on failed strdup

Use a non-malloc'd string upon failed strdup so
we don't have to diagnose failure.

Signed-off-by: Jim Meyering <meyer...@redhat.com>
---
 server/status.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/server/status.c b/server/status.c
index e9fbb38..7d4cc9a 100644
--- a/server/status.c
+++ b/server/status.c
@@ -1,6 +1,6 @@

 /*
- * Copyright 2008-2009 Red Hat, Inc.
+ * Copyright 2008-2010 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -158,13 +158,14 @@ bool stat_evt_http_req(struct client *cli, unsigned int 
events)
        char *path = NULL;
        // int rc;
        bool rcb;
+       char *root = (char *) "/";

        /* grab useful headers */
        // content_len_str = hreq_hdr(req, "content-length");

        path = strdup(req->uri.path);
        if (!path)
-               path = strdup("/");
+               path = root;

        if (debugging)
                applog(LOG_INFO, "%s: status method %s, path '%s'",
@@ -195,6 +196,7 @@ bool stat_evt_http_req(struct client *cli, unsigned int 
events)
                rcb = stat_err(cli, InvalidArgument);
        }

-       free(path);
+       if (path != root);
+               free(path);
        return rcb;
 }
--
1.7.3.234.g7bba3
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to