From 10b8ef61c0f25060b2d1f865ba85edf62a207881 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Thu, 14 Jul 2005 09:23:12 +0000 Subject: [PATCH] (get_scrap_target_type_list): Avoid NULL pointer dereference. --- src/macselect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/macselect.c b/src/macselect.c index b519950eb75..94fe591a206 100644 --- a/src/macselect.c +++ b/src/macselect.c @@ -371,7 +371,7 @@ get_scrap_target_type_list (scrap) 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 @@ get_scrap_target_type_list (scrap) flavor_info = NULL; } } + if (flavor_info == NULL) + count = 0; #endif for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) { -- 2.39.5