On Sat, Sep 15, 2012 at 01:56:32AM +0200, Michal Nazarewicz wrote:
> static int __ffs_data_got_descs(struct ffs_data *ffs,
> char *const _data, size_t len)
> {
> …
>
> ffs->raw_fs_descs_length = fs_len;
> ffs->raw_descs_length = fs_len + ret;
> ffs->raw_descs = _data;
>
> Saved for later.
>
> ffs->fs_descs_count = fs_count;
> ffs->hs_descs_count = hs_count;
>
> return 0;
>
> einval:
> ret = -EINVAL;
> error:
> kfree(_data);
>
> Freed on error path.
>
> return ret;
> }
Okay so it is not symetrical.
> static int __ffs_data_got_strings(struct ffs_data *ffs,
> char *const _data, size_t len)
> {
> …
>
> /*
> * If we don't need any strings just return and free all
> * memory.
> */
> if (!needed_count) {
> kfree(_data);
>
> Freed on quick exit.
>
> return 0;
> }
>
> …
>
> /* Done! */
> ffs->stringtabs = stringtabs;
> ffs->raw_strings = _data;
>
> Saved for later.
>
> return 0;
>
> error_free:
> kfree(stringtabs);
> error:
> kfree(_data);
>
> Freed on error path.
>
> return -EINVAL;
> }
same here.
> And later:
>
> static void ffs_data_clear(struct ffs_data *ffs)
> {
> ENTER();
>
> if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags))
> functionfs_closed_callback(ffs);
>
> BUG_ON(ffs->gadget);
>
> if (ffs->epfiles)
> ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count);
>
> kfree(ffs->raw_descs);
>
> Free descs saved for later.
>
> kfree(ffs->raw_strings);
>
> Free strings saved for later.
>
> kfree(ffs->stringtabs);
> }
Okay. Thanks for the update.
Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html