From: Victor Julien Date: Mon, 2 Dec 2013 20:11:02 +0000 (+0100) Subject: Don't alloc for hash lookup in SCClassConfGetClasstype X-Git-Tag: suricata-2.0beta2~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8344854a1f5f92333bf2f9d2ecf10d4694e4dc15;p=thirdparty%2Fsuricata.git Don't alloc for hash lookup in SCClassConfGetClasstype --- diff --git a/src/util-classification-config.c b/src/util-classification-config.c index 72cfadaaa0..3a0d62a8cb 100644 --- a/src/util-classification-config.c +++ b/src/util-classification-config.c @@ -543,14 +543,15 @@ void SCClassConfLoadClassficationConfigFile(DetectEngineCtx *de_ctx) SCClassConfClasstype *SCClassConfGetClasstype(const char *ct_name, DetectEngineCtx *de_ctx) { - SCClassConfClasstype *ct_info = SCClassConfAllocClasstype(0, ct_name, NULL, - 0); - if (ct_info == NULL) - return NULL; - SCClassConfClasstype *lookup_ct_info = HashTableLookup(de_ctx->class_conf_ht, - ct_info, 0); + char name[strlen(ct_name) + 1]; + size_t s; + for (s = 0; s < strlen(ct_name); s++) + name[s] = tolower((unsigned char)ct_name[s]); + name[s] = '\0'; - SCClassConfDeAllocClasstype(ct_info); + SCClassConfClasstype ct_lookup = {0, name, NULL, 0 }; + SCClassConfClasstype *lookup_ct_info = HashTableLookup(de_ctx->class_conf_ht, + &ct_lookup, 0); return lookup_ct_info; }