* Frees all memory allocated for an nvpair (like embedded lists) with * the exception of the nvpair buffer itself. */
| 839 | * the exception of the nvpair buffer itself. |
| 840 | */ |
| 841 | static void |
| 842 | nvpair_free(nvpair_t *nvp) |
| 843 | { |
| 844 | switch (NVP_TYPE(nvp)) { |
| 845 | case DATA_TYPE_NVLIST: |
| 846 | nvlist_free(EMBEDDED_NVL(nvp)); |
| 847 | break; |
| 848 | case DATA_TYPE_NVLIST_ARRAY: { |
| 849 | nvlist_t **nvlp = EMBEDDED_NVL_ARRAY(nvp); |
| 850 | int i; |
| 851 | |
| 852 | for (i = 0; i < NVP_NELEM(nvp); i++) |
| 853 | if (nvlp[i] != NULL) |
| 854 | nvlist_free(nvlp[i]); |
| 855 | break; |
| 856 | } |
| 857 | default: |
| 858 | break; |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | /* |
| 863 | * nvlist_free - free an unpacked nvlist |
no test coverage detected