2010/1/18 Jim Meyering <jim(a)meyering.net>:
Obvious, for a change...
>From 964f24e0724eda6bf12d115318ea9576bbd91f10 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 18 Jan 2010 18:40:13 +0100
Subject: [PATCH] storage_conf: plug a leak on OOM error path
* src/conf/storage_conf.c (virStoragePoolSourceListNewSource):
Free just-allocated "source" upon VIR_REALLOC_N failure.
---
src/conf/storage_conf.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 0aefa06..ea49531 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1,7 +1,7 @@
/*
* storage_conf.c: config handling for storage driver
*
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
* Copyright (C) 2006-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -1695,6 +1695,7 @@ virStoragePoolSourceListNewSource(virConnectPtr conn,
}
if (VIR_REALLOC_N(list->sources, list->nsources+1) < 0) {
+ VIR_FREE(source);
virReportOOMError(conn);
return NULL;
}
--
1.6.6.638.g2bc54
ACK.
Matthias