diff options
author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2020-09-29 12:09:55 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2020-09-30 10:50:30 +0200 |
commit | 0fd16012adc0a994a7ce980a78e22e4de6220778 (patch) | |
tree | a61c43f7314e424e4814a91ed437c485ac031dc6 /include/linux/string_helpers.h | |
parent | 3795d7cc4fe13200dae9fade93441b4d5f123b74 (diff) | |
download | linux-0fd16012adc0a994a7ce980a78e22e4de6220778.tar.gz linux-0fd16012adc0a994a7ce980a78e22e4de6220778.tar.bz2 linux-0fd16012adc0a994a7ce980a78e22e4de6220778.zip |
lib: string_helpers: provide kfree_strarray()
There's a common pattern of dynamically allocating an array of char
pointers and then also dynamically allocating each string in this
array. Provide a helper for freeing such a string array with one call.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'include/linux/string_helpers.h')
-rw-r--r-- | include/linux/string_helpers.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index 86f150c2a6b6..fa06dcdc481e 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -94,4 +94,6 @@ char *kstrdup_quotable(const char *src, gfp_t gfp); char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp); char *kstrdup_quotable_file(struct file *file, gfp_t gfp); +void kfree_strarray(char **array, size_t n); + #endif |