Re: [PATCH 23/23] Make usbFreeDevice accept a NULL device

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

 



On 2012年12月01日 04:26, Daniel P. Berrange wrote:
From: "Daniel P. Berrange"<berrange@xxxxxxxxxx>

Common practice is to accept NULL for all "free" methods

Signed-off-by: Daniel P. Berrange<berrange@xxxxxxxxxx>
---
  src/util/hostusb.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/src/util/hostusb.c b/src/util/hostusb.c
index 24f925b..79b04eb 100644
--- a/src/util/hostusb.c
+++ b/src/util/hostusb.c
@@ -355,6 +355,9 @@ usbGetDevice(unsigned int bus,
  void
  usbFreeDevice(usbDevice *dev)
  {
+    if (!dev)
+        return;
+
      VIR_DEBUG("%s %s: freeing", dev->id, dev->name);
      VIR_FREE(dev->path);
      VIR_FREE(dev);

ACK

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