Here's another:

>From d427a9543cc192649a648c5f11ec112e9fe66eb5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Thu, 19 Mar 2009 14:51:20 +0100
Subject: [PATCH] don't store (and later dereference NULL) upon strdup failure

(ld_library_path_build): Don't store NULL when strdup fails.
---
 lcr/lcr_ifact.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lcr/lcr_ifact.c b/lcr/lcr_ifact.c
index b1ea5dc..4548b96 100644
--- a/lcr/lcr_ifact.c
+++ b/lcr/lcr_ifact.c
@@ -200,7 +200,9 @@ static void ld_library_path_build (void)

        p_s = strtok_r (my_ld_library_path, ":", &ptrptr);
        while (p_s != NULL) {
-               path_list[path_list_entries++] = strdup (p_s);
+               char *p = strdup (p_s);
+               if (p)
+                       path_list[path_list_entries++] = p;
                p_s = strtok_r (NULL, ":", &ptrptr);
        }

--
1.6.2.rc1.285.gc5f54
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to