]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
memory_utils: make it easier for Coverity
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 15 Apr 2020 13:32:44 +0000 (15:32 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 15 Apr 2020 13:58:09 +0000 (15:58 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/memory_utils.h

index 87d9c6dca67ba2c49cd1a1c97c0b46b55300c235..2916f566289a5ef7c0fd83cedaa94132c12dd821 100644 (file)
        }
 
 #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 +50,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)