[PATCH 1/6] Fix memory leak in openvz_conf.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If there is no error while executing a function "openvzParseBarrierLimit"
a "str" string where is duplicate of a "value" string isn't freed and it
leads into memory leak.

This has been found by coverity.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/openvz/openvz_conf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 0dbaa4a..91b16f8 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -136,6 +136,7 @@ openvzParseBarrierLimit(const char* value,
     char *token;
     char *saveptr = NULL;
     char *str;
+    int ret = -1;
 
     if (VIR_STRDUP(str, value) < 0)
         goto error;
@@ -158,10 +159,10 @@ openvzParseBarrierLimit(const char* value,
                 goto error;
         }
     }
-    return 0;
+    ret = 0;
 error:
     VIR_FREE(str);
-    return -1;
+    return ret;
 }
 
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]