The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/393

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 7eaf033e0352f43a86068e7afe4f29fb15534bcd Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Wed, 15 Apr 2020 15:32:44 +0200
Subject: [PATCH] memory_utils: make it easier for Coverity

Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 src/memory_utils.h | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/memory_utils.h b/src/memory_utils.h
index 87d9c6d..c4af530 100644
--- a/src/memory_utils.h
+++ b/src/memory_utils.h
@@ -7,7 +7,6 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 
@@ -31,12 +30,12 @@
        }
 
 #define close_prot_errno_replace(fd, new_fd) \
-       if (fd >= 0) {                       \
-               int _e_ = errno;             \
-               close(fd);                   \
-               errno = _e_;                 \
-               fd = new_fd;                 \
-       }
+       if (fd >= 0) {                       \
+               int _e_ = errno;             \
+               close(fd);                   \
+               errno = _e_;                 \
+               fd = new_fd;                 \
+       }
 
 static inline void close_prot_errno_disarm_function(int *fd)
 {
@@ -50,10 +49,10 @@ define_cleanup_function(FILE *, fclose);
 define_cleanup_function(DIR *, closedir);
 #define __do_closedir call_cleaner(closedir)
 
-#define free_disarm(ptr)       \
-       ({                     \
-               free(ptr);     \
-               move_ptr(ptr); \
+#define free_disarm(ptr)    \
+       ({                  \
+               free(ptr);  \
+               ptr = NULL; \
        })
 
 static inline void free_disarm_function(void *ptr)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to