[Groonga-commit] groonga/groonga at f3366ff [master] groonga-httpd: free temporary allocated string explicitly

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Aug 20 18:50:07 JST 2013


Kouhei Sutou	2013-08-20 18:50:07 +0900 (Tue, 20 Aug 2013)

  New Revision: f3366ffc5294c5919352f5f83506448f4610a5d1
  https://github.com/groonga/groonga/commit/f3366ffc5294c5919352f5f83506448f4610a5d1

  Message:
    groonga-httpd: free temporary allocated string explicitly

  Modified files:
    src/httpd/nginx-module/ngx_http_groonga_module.c

  Modified: src/httpd/nginx-module/ngx_http_groonga_module.c (+5 -3)
===================================================================
--- src/httpd/nginx-module/ngx_http_groonga_module.c    2013-08-20 18:31:29 +0900 (0bad1cc)
+++ src/httpd/nginx-module/ngx_http_groonga_module.c    2013-08-20 18:50:07 +0900 (e0259be)
@@ -746,8 +746,9 @@ static char *
 ngx_http_groonga_conf_set_log_level_slot(ngx_conf_t *cf, ngx_command_t *cmd,
                                          void *conf)
 {
+  char *status = NGX_CONF_OK;
   ngx_http_groonga_loc_conf_t *groonga_location_conf = conf;
-  const char *value;
+  char *value;
 
   value = ngx_str_null_terminate(cf->cycle->pool,
                                  ((ngx_str_t *)cf->args->elts) + 1);
@@ -772,11 +773,12 @@ ngx_http_groonga_conf_set_log_level_slot(ngx_conf_t *cf, ngx_command_t *cmd,
   } else if (strcasecmp(value, "dump") == 0) {
     groonga_location_conf->log_level = GRN_LOG_DUMP;
   } else {
-    return "must be one of 'none', 'emergency', 'alert', "
+    status = "must be one of 'none', 'emergency', 'alert', "
       "'ciritical', 'error', 'warning', 'notice', 'info', 'debug' and 'dump'";
   }
+  ngx_pfree(cf->cycle->pool, value);
 
-  return NGX_CONF_OK;
+  return status;
 }
 
 static void *
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index