server/status.c: don't deref NULL on failed strdup
PATCH 1/1 server/status.c: don't deref NULL on failed strdup
From aed01fa24688257fdf6f3c5ecf6983f61b8749f8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
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 <[email protected]>
--- server/status.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
server/status.c +5 -3
@@ -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