From 028a37f6e7f0fff6eb31862f3bca75ecb1b2beab Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Tue, 20 Nov 2012 10:21:16 +0100 Subject: [PATCH] unix runmode: use unlikely for memory error --- src/runmode-unix-socket.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runmode-unix-socket.c b/src/runmode-unix-socket.c index 35fa919da4..c835573fe5 100644 --- a/src/runmode-unix-socket.c +++ b/src/runmode-unix-socket.c @@ -145,14 +145,14 @@ TmEcode UnixListAddFile(PcapCommand *this, const char *filename, const char *out if (filename == NULL || this == NULL) return TM_ECODE_FAILED; cfile = SCMalloc(sizeof(PcapFiles)); - if (cfile == NULL) { + if (unlikely(cfile == NULL)) { SCLogError(SC_ERR_MEM_ALLOC, "Unable to allocate new file"); return TM_ECODE_FAILED; } memset(cfile, 0, sizeof(PcapFiles)); cfile->filename = SCStrdup(filename); - if (cfile->filename == NULL) { + if (unlikely(cfile->filename == NULL)) { SCFree(cfile); SCLogError(SC_ERR_MEM_ALLOC, "Unable to dup filename"); return TM_ECODE_FAILED; @@ -160,7 +160,7 @@ TmEcode UnixListAddFile(PcapCommand *this, const char *filename, const char *out if (output_dir) { cfile->output_dir = SCStrdup(output_dir); - if (cfile->output_dir == NULL) { + if (unlikely(cfile->output_dir == NULL)) { SCFree(cfile->filename); SCFree(cfile); SCLogError(SC_ERR_MEM_ALLOC, "Unable to dup output_dir"); @@ -349,7 +349,7 @@ int RunModeUnixSocketSingle(DetectEngineCtx *de_ctx) #ifdef BUILD_UNIX_SOCKET PcapCommand *pcapcmd = SCMalloc(sizeof(PcapCommand)); - if (pcapcmd == NULL) { + if (unlikely(pcapcmd == NULL)) { SCLogError(SC_ERR_MEM_ALLOC, "Can not allocate pcap command"); return 1; } -- 2.47.3