Re: [PATCH 07/11] uml: If need to requery, then VIR_FREE(res)

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

 



On 2013年01月31日 03:36, John Ferlan wrote:
Coverity noted that in the retry logic loop if res had been set, then
it could be leaked
---
  src/uml/uml_driver.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 705495e..d97cc96 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1,7 +1,7 @@
  /*
   * uml_driver.c: core driver methods for managing UML guests
   *
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
   * Copyright (C) 2006-2008 Daniel P. Berrange
   *
   * This library is free software; you can redistribute it and/or
@@ -263,6 +263,7 @@ requery:
             way somehow ...perhaps register a timer */
          if (retries++<  50) {
              usleep(1000*10);
+            VIR_FREE(res);

Personally I'd like the VIR_FREE above the "if" branch, but since
VIR_FREE(res) at the end of the function will take over the work
if "retries" happened to be 50. It's fine.

However, putting VIR_FREE before the sleeping is never a bad idea.

ACK with the added VIR_FREE moved 1 line above.

--
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]