Hi, I wonder if it wouldn't be better to check if val->data is NULL before freeing ? To me the function makes otherwise no sense as I have to do the same checks myself before I can call the function safely. void KRB5_CALLCONV krb5_free_data(krb5_context context, krb5_data *val) { if (val == NULL) return; free(val->data); free(val); } Thank you Markus