# HG changeset patch
# User Steven Hand <steven@xxxxxxxxxxxxx>
# Node ID ba3061912d3d92a1d3e5a52f640cbc3e93f41f90
# Parent 1ff4cc298bec6c4fc2a21315f25092ebf3b47117
Ensure get_dom_domid() terminates even when /local/domain/<foo>/name is
not present.
Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx>
---
tools/blktap/lib/xs_api.c | 6 +-----
1 files changed, 1 insertion(+), 5 deletions(-)
diff -r 1ff4cc298bec -r ba3061912d3d tools/blktap/lib/xs_api.c
--- a/tools/blktap/lib/xs_api.c Thu Aug 24 09:49:41 2006 +0100
+++ b/tools/blktap/lib/xs_api.c Thu Aug 24 14:07:01 2006 +0100
@@ -180,8 +180,7 @@ char *get_dom_domid(struct xs_handle *h,
e = xs_directory(h, xth, "/local/domain", &num);
- i = 0;
- while (i < num) {
+ for (i = 0; (i < num) && (domid == NULL); i++) {
asprintf(&path, "/local/domain/%s/name", e[i]);
val = xs_read(h, xth, path, &len);
free(path);
@@ -192,12 +191,9 @@ char *get_dom_domid(struct xs_handle *h,
/* match! */
asprintf(&path, "/local/domain/%s/domid", e[i]);
domid = xs_read(h, xth, path, &len);
- free(val);
free(path);
- break;
}
free(val);
- i++;
}
xs_transaction_end(h, xth, 0);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|