rx: Don't crash when emptying an empty identity
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 1 Jan 2011 23:51:18 +0000 (23:51 +0000)
committerJeffrey Altman <jaltman@openafs.org>
Sun, 2 Jan 2011 03:18:28 +0000 (19:18 -0800)
In common with our other freeContents functions, freeing the contents
of a structure which is already empty shouldn't crash.

Change-Id: I93b54c0e450d2184c10575b50dadfd1471d43289
Reviewed-on: http://gerrit.openafs.org/3606
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/rx/rx_identity.c

index 7f50ed0..514d97b 100644 (file)
@@ -164,8 +164,11 @@ rx_identity_new(rx_identity_kind kind, char *displayName, void *enameData,
 void
 rx_identity_freeContents(struct rx_identity *identity)
 {
-    rxi_Free(identity->displayName, strlen(identity->displayName));
-    identity->displayName = NULL;
+    if (identity->displayName) {
+       rxi_Free(identity->displayName, strlen(identity->displayName));
+       identity->displayName = NULL;
+    }
+
     rx_opaque_freeContents(&identity->exportedName);
 }