diff src/scrollbar-x.c @ 3462:6c7605dfcf07

[xemacs-hg @ 2006-06-19 18:19:33 by james] Fix various problems found by static checkers: use of uninitialized values, dereferencing pointers before checking whether they are NULL, memory leaks, and incomplete checking of return values. <m3k67gpyhk.fsf@jerrypc.cs.usu.edu>
author james
date Mon, 19 Jun 2006 18:19:38 +0000
parents b7f26b2f78bd
children 16112448d484
line wrap: on
line diff
--- a/src/scrollbar-x.c	Mon Jun 19 18:10:19 2006 +0000
+++ b/src/scrollbar-x.c	Mon Jun 19 18:19:38 2006 +0000
@@ -72,19 +72,21 @@
 static void
 x_free_scrollbar_instance (struct scrollbar_instance *instance)
 {
-  if (SCROLLBAR_X_NAME (instance))
-    xfree (SCROLLBAR_X_NAME (instance), char *);
-
-  if (SCROLLBAR_X_WIDGET (instance))
+  if (instance->scrollbar_data)
     {
-      if (XtIsManaged (SCROLLBAR_X_WIDGET (instance)))
-	XtUnmanageChild (SCROLLBAR_X_WIDGET (instance));
+      if (SCROLLBAR_X_NAME (instance))
+	xfree (SCROLLBAR_X_NAME (instance), char *);
 
-      lw_destroy_all_widgets (SCROLLBAR_X_ID (instance));
-    }
+      if (SCROLLBAR_X_WIDGET (instance))
+	{
+	  if (XtIsManaged (SCROLLBAR_X_WIDGET (instance)))
+	    XtUnmanageChild (SCROLLBAR_X_WIDGET (instance));
 
-  if (instance->scrollbar_data)
-    xfree (instance->scrollbar_data, void *);
+	  lw_destroy_all_widgets (SCROLLBAR_X_ID (instance));
+	}
+
+      xfree (instance->scrollbar_data, void *);
+    }
 }
 
 /* A device method. */