kfree_strarray(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ kfree_strarray β€” the kernel API manual, bestie edition ✨

okay so you're in the Kernel API Manual and the function we're talking about is kfree_strarray(9). yes that's the title, yes I'm telling you up front, we're doing this properly πŸ’…


🌸 NAME 🌸

kfree_strarray β€” frees a number of dynamically allocated strings that are chilling inside an array, plus the array itself. like, the whole thing goes 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

void kfree_strarray (char **array , size_t n );

πŸ’– ARGUMENTS πŸ’–

  • array β€” the dynamically allocated array of strings you want to free. it's a char **, it's living its best life on the heap, and now it's gotta go ✨
  • n β€” the number of strings to free, counting from the beginning of the array. so like, the first n ones, in order, no skipping πŸ™ˆ

πŸŽ€ DESCRIPTION πŸŽ€

okay so there are two very valid use-cases here and I need you to not panic about either of them:

  1. passing a non-NULL array together with n == 0 β€” totally valid, no notes πŸ’…
  2. passing a NULL array β€” also valid, also fine, we love a flexible API

and if array is NULL? the function literally does nothing. that's it. that's the whole vibe check. nothing happens, no crash, no drama, we simply move on 🧚


πŸ”₯ SEE ALSO πŸ”₯


ngl if you got here, you're giving kernel dev main character energy πŸ‘‘ go read the whole string_helpers.c bestie, iykyk

and that's the page!! 🌈 this little icon comes from ./lib, dated October 2026, and it's filed under kfree_strarray(9) β€” mwah, periodt πŸ’œπŸŽ€

πŸ“¦ where this page comes from