xl/libxl: fixes for vsnd
cover xl/libxl: fixes for vsnd
Wei Liu (3):
libxl/vsnd: add missing error checks xl/vsnd: use xcalloc to allocate memory for parser xl/vsnd: initialise rc in dryrun path
tools/libxl/libxl_vsnd.c | 2 ++ tools/xl/xl_parse.c | 12 ++++++------ tools/xl/xl_vsnd.c | 1 + 3 files changed, 9 insertions(+), 6 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 1/3 libxl/vsnd: add missing error checks
Reported-by Coverity
Signed-off-by Wei Liu <[email protected]>
--- tools/libxl/libxl_vsnd.c | 2 ++ 1 file changed, 2 insertions(+)
tools/libxl/libxl_vsnd.c +2 -0
@@ -192,6 +192,7 @@ static int libxl__pcm_from_xenstore(libxl__gc *gc, const char *path, GCSPRINTF("%s/"XENSND_FIELD_DEVICE_NAME, path), NULL); rc =libxl__params_from_xenstore (gc, path, &pcm->params); +if (rc) goto out; pcm->streams =NULL ; pcm->num_vsnd_streams =0 ;
@@ -253,6 +254,7 @@ static int libxl__vsnd_from_xenstore(libxl__gc *gc, const char *libxl_path, fe_path), NULL); rc =libxl__params_from_xenstore (gc, fe_path, &vsnd->params); +if (rc) goto out; vsnd->pcms =NULL ; vsnd->num_vsnd_pcms =0 ;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/3 xl/vsnd: use xcalloc to allocate memory for parser
In reply to Wei Liu... because it handles errors for us.
Reported-by Coverity
Signed-off-by Wei Liu <[email protected]>
--- tools/xl/xl_parse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/xl/xl_parse.c +6 -6
@@ -820,8 +820,8 @@ int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token)split_string_into_string_list (oparg,";" , &connectors); vdispl->num_connectors =libxl_string_list_length (&connectors); - vdispl->connectors =calloc (vdispl->num_connectors, -sizeof (*vdispl->connectors)); + vdispl->connectors =xcalloc (vdispl->num_connectors, +sizeof (*vdispl->connectors));for (i =0 ; i < vdispl->num_connectors; i++) {
@@ -863,8 +863,8 @@ static int parse_vsnd_params(libxl_vsnd_params *params, char *token)split_string_into_string_list (oparg,";" , &rates); params->num_sample_rates =libxl_string_list_length (&rates); - params->sample_rates =calloc (params->num_sample_rates, -sizeof (*params->sample_rates)); + params->sample_rates =xcalloc (params->num_sample_rates, +sizeof (*params->sample_rates));for (i =0 ; i < params->num_sample_rates; i++) { params->sample_rates[i] =strtoul (rates[i],NULL ,0 );
@@ -877,8 +877,8 @@ static int parse_vsnd_params(libxl_vsnd_params *params, char *token)split_string_into_string_list (oparg,";" , &formats); params->num_sample_formats =libxl_string_list_length (&formats); - params->sample_formats =calloc (params->num_sample_formats, -sizeof (*params->sample_formats)); + params->sample_formats =xcalloc (params->num_sample_formats, +sizeof (*params->sample_formats));for (i =0 ; i < params->num_sample_formats; i++) {libxl_vsnd_pcm_format format;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 3/3 xl/vsnd: initialise rc in dryrun path
In reply to Wei LiuReported-by Coverity
Signed-off-by Wei Liu <[email protected]>
--- tools/xl/xl_vsnd.c | 1 + 1 file changed, 1 insertion(+)
tools/xl/xl_vsnd.c +1 -0
@@ -46,6 +46,7 @@ int main_vsndattach(int argc, char **argv)if (dryrun_only) {char *json =libxl_device_vsnd_to_json (ctx, &vsnd);printf ("vsnd: %s\n" , json); + rc =0 ;free (json); goto out; }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Wei Liu writes ("[PATCH 0/3] xl/libxl: fixes for vsnd "):
Quoted 4 lines
Wei Liu (3):
libxl/vsnd: add missing error checks xl/vsnd: use xcalloc to allocate memory for parser xl/vsnd: initialise rc in dryrun path
All three,
Acked-by Ian Jackson <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel