changeset 64312:c528a5858404

(get_scrap_target_type_list): Avoid NULL pointer dereference.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Thu, 14 Jul 2005 09:23:12 +0000
parents d1bb70278f2a
children 3b2fdd9aa557
files src/macselect.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/macselect.c	Thu Jul 14 08:27:30 2005 +0000
+++ b/src/macselect.c	Thu Jul 14 09:23:12 2005 +0000
@@ -371,7 +371,7 @@
   err = GetScrapFlavorCount (scrap, &count);
   if (err == noErr)
     flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count);
-  if (err == noErr && flavor_info)
+  if (flavor_info)
     {
       err = GetScrapFlavorInfoList (scrap, &count, flavor_info);
       if (err != noErr)
@@ -380,6 +380,8 @@
 	  flavor_info = NULL;
 	}
     }
+  if (flavor_info == NULL)
+    count = 0;
 #endif
   for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest))
     {