]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Add zapfreedata() convenience function
authorGreg Hudson <ghudson@mit.edu>
Thu, 14 Mar 2019 15:26:44 +0000 (11:26 -0400)
committerGreg Hudson <ghudson@mit.edu>
Fri, 15 Mar 2019 15:36:44 +0000 (11:36 -0400)
src/include/k5-int.h

index 71dce7315fd6328db0dc844c15d16efa5d782a0e..f24e92ccea70e14969c52d02140f26d2217c9e54 100644 (file)
@@ -666,6 +666,16 @@ zapfreestr(void *str)
     }
 }
 
+/* Convenience function: zap and free krb5_data pointer if it is non-NULL. */
+static inline void
+zapfreedata(krb5_data *data)
+{
+    if (data != NULL) {
+        zapfree(data->data, data->length);
+        free(data);
+    }
+}
+
 /*
  * Combine two keys (normally used by the hardware preauth mechanism)
  */