]> git.alsa-project.org Git - alsa-utils.git/commitdiff
Fix segfault with no-capture devices
authorTakashi Iwai <tiwai@suse.de>
Mon, 23 May 2005 16:48:17 +0000 (16:48 +0000)
committerTakashi Iwai <tiwai@suse.de>
Mon, 23 May 2005 16:48:17 +0000 (16:48 +0000)
Fix segfault on the device without capture controls when the view
is changed to capture mode (bug #1080).

alsamixer/alsamixer.c

index 41d4e2bf224dddbccb5ce03a17bc93cdd82f696c..5af985312b4d04266a4c2c78e32d4fb38a38b4f4 100644 (file)
@@ -1679,12 +1679,12 @@ __again:
 
   if (mixer_type)
     free(mixer_type);
-  mixer_type = (int *)malloc(sizeof(int) * mixer_n_elems);
+  mixer_type = (int *)calloc(mixer_n_elems, sizeof(int));
   if (mixer_type == NULL)
     mixer_abort(ERR_FCN, "malloc", 0);
   if (mixer_grpidx)
     free(mixer_grpidx);
-  mixer_grpidx = (int *)malloc(sizeof(int) * mixer_n_elems);
+  mixer_grpidx = (int *)calloc(mixer_n_elems, sizeof(int));
   if (mixer_grpidx == NULL)
     mixer_abort(ERR_FCN, "malloc", 0);
   elem_index = 0;