mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
xl: correct handling of extra_config in main_cpupoolcreate
Don't dereference extra_config if it's NULL. Don't leak extra_config in
the end.
Also fixed a typo in error string while I was there.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
(cherry picked from commit 705c9e1242)
This commit is contained in:
1 parent
2049db3602
commit
ffb4e6387f
1 file changed
+3
-2
@@ -7099,9 +7099,9 @@ int main_cpupoolcreate(int argc, char **argv)
|
||||
else
|
||||
config_src="command line";
|
||||
|
||||
if (strlen(extra_config)) {
|
||||
if (extra_config && strlen(extra_config)) {
|
||||
if (config_len > INT_MAX - (strlen(extra_config) + 2)) {
|
||||
fprintf(stderr, "Failed to attach extra configration\n");
|
||||
fprintf(stderr, "Failed to attach extra configuration\n");
|
||||
goto out;
|
||||
}
|
||||
config_data = xrealloc(config_data,
|
||||
@@ -7225,6 +7225,7 @@ out_cfg:
|
||||
out:
|
||||
free(name);
|
||||
free(config_data);
|
||||
free(extra_config);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||