Changeset 771 for GPL/branches


Ignore:
Timestamp:
Apr 15, 2025, 11:31:12 AM (4 months ago)
Author:
Paul Smedley
Message:

Reinstate kfree() calls where required

Location:
GPL/branches/uniaud32-exp
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-exp/alsa-kernel/core/control.c

    r767 r771  
    956956                        }
    957957                        offset = 0;
    958                         }
    959958                }
     959        }
    960960 out:
    961961        up_read(&card->controls_rwsem);
     
    13131313        snd_power_unref(card);
    13141314        if (result < 0)
    1315                 return result;
     1315                goto error;
    13161316
    13171317        if (copy_to_user(_control, control, sizeof(*control)))
    1318                 return -EFAULT;
     1318                result = -EFAULT;
     1319 error:
     1320        kfree(control);
    13191321        return result;
    13201322}
     
    13891391        result = snd_power_ref_and_wait(card);
    13901392        if (result < 0)
    1391                 return result;
     1393                goto error;
    13921394        result = snd_ctl_elem_write(card, file, control);
    13931395        snd_power_unref(card);
    13941396        if (result < 0)
    1395                 return result;
     1397                goto error;
    13961398
    13971399        if (copy_to_user(_control, control, sizeof(*control)))
    1398                 return -EFAULT;
     1400                result = -EFAULT;
     1401 error:
     1402        kfree(control);
    13991403        return result;
    14001404}
  • GPL/branches/uniaud32-exp/alsa-kernel/core/oss/pcm_oss.c

    r767 r771  
    415415                        goto _end;
    416416                params1 = kmalloc(sizeof(*params1), GFP_KERNEL);
    417                 if (params1 == NULL)
     417                if (params1 == NULL) {
     418                        kfree(save);
    418419                        return -ENOMEM;
     420                }
    419421                *params1 = *save;
    420422                max = snd_pcm_hw_param_max(pcm, params1, var, max, &maxdir);
    421                 if (max < 0)
     423                if (max < 0) {
     424                        kfree(params1);
    422425                        goto _end;
     426                }
    423427                if (boundary_nearer(max, maxdir, best, valdir, min, mindir)) {
    424428                        *params = *params1;
    425429                        last = 1;
    426430                }
     431                kfree(params1);
    427432        } else {
    428433                *params = *save;
    429434                max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir);
    430                 if (max < 0)
     435                if (max < 0) {
     436                        kfree(save);
    431437                        return max;
     438                }
    432439                last = 1;
    433440        }
    434441 _end:
     442        kfree(save);
    435443        if (last)
    436444                v = snd_pcm_hw_param_last(pcm, params, var, dir);
     
    810818                                                   SNDRV_PCM_HW_PARAM_RATE,
    811819                                                   rate, 0);
    812                         if (ret == (int)rate)
     820                        if (ret == (int)rate) {
     821                                kfree(save);
    813822                                return rate;
     823                        }
    814824                        *params = *save;
    815825                }
     
    821831
    822832        /* not found, use the nearest rate */
     833        kfree(save);
    823834        return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL);
    824835}
     
    18761887        err = snd_pcm_hw_refine(substream, params);
    18771888        if (err < 0)
    1878                 return err;
     1889                goto error;
    18791890        format_mask = hw_param_mask_c(params, SNDRV_PCM_HW_PARAM_FORMAT);
    18801891        for (fmt = 0; fmt < 32; ++fmt) {
     
    18861897        }
    18871898
    1888         return formats;
     1899 error:
     1900        kfree(params);
     1901        return err < 0 ? err : formats;
    18891902}
    18901903
  • GPL/branches/uniaud32-exp/alsa-kernel/core/pcm.c

    r770 r771  
    359359        if (err < 0) {
    360360                snd_iprintf(buffer, "error %d\n", err);
     361                kfree(info);
    361362                return;
    362363        }
     
    372373        snd_iprintf(buffer, "subdevices_count: %d\n", info->subdevices_count);
    373374        snd_iprintf(buffer, "subdevices_avail: %d\n", info->subdevices_avail);
     375        kfree(info);
    374376}
    375377
  • GPL/branches/uniaud32-exp/alsa-kernel/core/pcm_native.c

    r767 r771  
    252252                        err = -EFAULT;
    253253        }
     254        kfree(info);
    254255        return err;
    255256}
     
    439440
    440441                changed = r->func(params, r);
    441                 if (changed < 0)
    442                         return changed;
     442                if (changed < 0) {
     443                        err = changed;
     444                        goto out;
     445                }
    443446
    444447                /*
     
    471474                goto retry;
    472475
     476 out:
     477        kfree(rstamps);
    473478        return err;
    474479}
     
    591596        err = snd_pcm_hw_refine(substream, params);
    592597        if (err < 0)
    593                 return err;
     598                goto end;
    594599
    595600        err = fixup_unreferenced_params(substream, params);
    596601        if (err < 0)
    597                 return err;
     602                goto end;
    598603
    599604        if (copy_to_user(_params, params, sizeof(*params)))
    600                 return -EFAULT;
    601         return 0;
     605                err = -EFAULT;
     606end:
     607        kfree(params);
     608        return err;
    602609}
    603610
     
    884891        err = snd_pcm_hw_params(substream, params);
    885892        if (err < 0)
    886                 return err;
     893                goto end;
    887894
    888895        if (copy_to_user(_params, params, sizeof(*params)))
    889                 return -EFAULT;
     896                err = -EFAULT;
     897end:
     898        kfree(params);
    890899        return err;
    891900}
     
    23222331        substream1 = pcm_file->substream;
    23232332
    2324         if (substream == substream1)
    2325                 return -EINVAL;
     2333        if (substream == substream1) {
     2334                res = -EINVAL;
     2335                goto _badf;
     2336        }
    23262337
    23272338        group = kzalloc(sizeof(*group), GFP_KERNEL);
     
    33603371        else
    33613372                result = snd_pcm_lib_readv(substream, bufs, xfern.frames);
     3373        kfree(bufs);
    33623374        if (put_user(result, &_xfern->result))
    33633375                return -EFAULT;
     
    36563668        if (result > 0)
    36573669                result = frames_to_bytes(runtime, result);
     3670        kfree(bufs);
    36583671        return result;
    36593672}
     
    36943707        if (result > 0)
    36953708                result = frames_to_bytes(runtime, result);
     3709        kfree(bufs);
    36963710        return result;
    36973711}
     
    41494163
    41504164        oparams = memdup_user(_oparams, sizeof(*oparams));
    4151         if (IS_ERR(oparams))
    4152                 return PTR_ERR(oparams);
     4165        if (IS_ERR(oparams)) {
     4166                err = PTR_ERR(oparams);
     4167                goto out;
     4168        }
    41534169        snd_pcm_hw_convert_from_old_params(params, oparams);
    41544170        err = snd_pcm_hw_refine(substream, params);
    41554171        if (err < 0)
    4156                 return err;
     4172                goto out_old;
    41574173
    41584174        err = fixup_unreferenced_params(substream, params);
    41594175        if (err < 0)
    4160                 return err;
     4176                goto out_old;
    41614177
    41624178        snd_pcm_hw_convert_to_old_params(oparams, params);
    41634179        if (copy_to_user(_oparams, oparams, sizeof(*oparams)))
    4164                 return -EFAULT;
    4165         return 0;
     4180                err = -EFAULT;
     4181out_old:
     4182        kfree(oparams);
     4183out:
     4184        kfree(params);
     4185        return err;
    41664186}
    41674187
     
    41784198
    41794199        oparams = memdup_user(_oparams, sizeof(*oparams));
    4180         if (IS_ERR(oparams))
    4181                 return PTR_ERR(oparams);
     4200        if (IS_ERR(oparams)) {
     4201                err = PTR_ERR(oparams);
     4202                goto out;
     4203        }
    41824204
    41834205        snd_pcm_hw_convert_from_old_params(params, oparams);
    41844206        err = snd_pcm_hw_params(substream, params);
    41854207        if (err < 0)
    4186                 return err;
     4208                goto out_old;
    41874209
    41884210        snd_pcm_hw_convert_to_old_params(oparams, params);
    41894211        if (copy_to_user(_oparams, oparams, sizeof(*oparams)))
    4190                 return -EFAULT;
    4191         return 0;
     4212                err = -EFAULT;
     4213out_old:
     4214        kfree(oparams);
     4215out:
     4216        kfree(params);
     4217        return err;
    41924218}
    41934219#endif /* CONFIG_SND_SUPPORT_OLD_API */
  • GPL/branches/uniaud32-exp/alsa-kernel/core/seq/oss/seq_oss_init.c

    r766 r771  
    6868
    6969        port = kzalloc(sizeof(*port), GFP_KERNEL);
    70         if (!port)
    71                 return -ENOMEM;
     70        if (!port) {
     71                rc = -ENOMEM;
     72                goto __error;
     73        }
    7274
    7375        /* create ALSA client */
     
    7577                                          "OSS sequencer");
    7678        if (rc < 0)
    77                 return rc;
     79                goto __error;
    7880
    7981        system_client = rc;
     
    103105                call_ctl(SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, &subs);
    104106        }
     107        rc = 0;
    105108
    106109        /* look up midi devices */
    107110        schedule_work(&async_lookup_work);
    108111
    109         return 0;
     112 __error:
     113        kfree(port);
     114        return rc;
    110115}
    111116
  • GPL/branches/uniaud32-exp/alsa-kernel/core/seq/oss/seq_oss_midi.c

    r766 r771  
    7070        clinfo = kzalloc(sizeof(*clinfo), GFP_KERNEL);
    7171        pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL);
    72         if (!clinfo || !pinfo)
     72        if (! clinfo || ! pinfo) {
     73                kfree(clinfo);
     74                kfree(pinfo);
    7375                return -ENOMEM;
     76        }
    7477        clinfo->client = -1;
    7578        while (snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT, clinfo) == 0) {
     
    8184                        snd_seq_oss_midi_check_new_port(pinfo);
    8285        }
     86        kfree(clinfo);
     87        kfree(pinfo);
    8388        return 0;
    8489}
  • GPL/branches/uniaud32-exp/alsa-kernel/core/seq/seq_midi.c

    r767 r771  
    302302        if (ports < input_count)
    303303                ports = input_count;
    304         if (ports == 0)
     304        if (ports == 0) {
     305                kfree(info);
    305306                return -ENODEV;
     307        }
    306308        if (ports > (256 / SNDRV_RAWMIDI_DEVICES))
    307309                ports = 256 / SNDRV_RAWMIDI_DEVICES;
  • GPL/branches/uniaud32-exp/alsa-kernel/core/timer.c

    r767 r771  
    17251725        } else {
    17261726                err = -ENODEV;
    1727                 }
     1727        }
    17281728        mutex_unlock(&register_mutex);
    17291729        if (err >= 0 && copy_to_user(_ginfo, ginfo, sizeof(*ginfo)))
  • GPL/branches/uniaud32-exp/alsa-kernel/core/vmaster.c

    r766 r771  
    6666        err = follower->follower.get(&follower->follower, uctl);
    6767        if (err < 0)
    68                 return err;
     68                goto error;
    6969        for (ch = 0; ch < follower->info.count; ch++)
    7070                follower->vals[ch] = uctl->value.integer.value[ch];
    71         return 0;
     71 error:
     72        kfree(uctl);
     73        return err < 0 ? err : 0;
    7274}
    7375
     
    9092        uinfo->id = follower->follower.id;
    9193        err = follower->follower.info(&follower->follower, uinfo);
    92         if (err < 0)
    93                 return err;
     94        if (err < 0) {
     95                kfree(uinfo);
     96                return err;
     97        }
    9498        follower->info.type = uinfo->type;
    9599        follower->info.count = uinfo->count;
     
    98102             follower->info.type != SNDRV_CTL_ELEM_TYPE_BOOLEAN)) {
    99103                pr_err("ALSA: vmaster: invalid follower element\n");
     104                kfree(uinfo);
    100105                return -EINVAL;
    101106        }
     
    103108        follower->info.max_val = uinfo->value.integer.max;
    104109
     110        kfree(uinfo);
    105111        return follower_update(follower);
    106112}
     
    359365                follower_put_val(follower, uval);
    360366        }
     367        kfree(uval);
    361368        return 0;
    362369}
  • GPL/branches/uniaud32-exp/uniaud.inc

    r767 r771  
    1313# ex RC3  GA  FIXPACK2 beta_47
    1414# Comment out to avoid a fixpack line in bldlevel
    15 FIXPACK = SVN r764
     15FIXPACK = SVN r771
Note: See TracChangeset for help on using the changeset viewer.