提交 3aa13a47 编写于 作者: J Jim Meyering

storage_conf: plug a leak on OOM error path

* src/conf/storage_conf.c (virStoragePoolSourceListNewSource):
Free just-allocated "source" upon VIR_REALLOC_N failure.
上级 4bc3bd7b
/* /*
* storage_conf.c: config handling for storage driver * 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 * Copyright (C) 2006-2008 Daniel P. Berrange
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -1695,6 +1695,7 @@ virStoragePoolSourceListNewSource(virConnectPtr conn, ...@@ -1695,6 +1695,7 @@ virStoragePoolSourceListNewSource(virConnectPtr conn,
} }
if (VIR_REALLOC_N(list->sources, list->nsources+1) < 0) { if (VIR_REALLOC_N(list->sources, list->nsources+1) < 0) {
VIR_FREE(source);
virReportOOMError(conn); virReportOOMError(conn);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册