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:
Wei Liu authored and Ian Jackson committed 2015-09-11 11:53:14 +01:00
1 parent 2049db3602
commit ffb4e6387f
1 file changed
+3 -2
+3 -2
View File
@@ -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;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.