]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Avoid confusing use of a pointer before checking it it's NULL. (The
authorNicholas Nethercote <njn@valgrind.org>
Wed, 25 May 2005 21:30:05 +0000 (21:30 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Wed, 25 May 2005 21:30:05 +0000 (21:30 +0000)
code from the glibc demangler is buggy, but because we use a malloc()
that never returns NULL, this code is actually ok within Valgrind, albeit
strange.  I changed it to avoid possible confusion.)

Reported by Madhu Kurup.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3805

coregrind/m_demangle/cp-demangle.c

index 7bd5d4c7032a0a9d5c9d59dc4835e8e61d744a57..591b95141b5ea0e1b2c8a3edb96f0d8e559aa59b 100644 (file)
@@ -413,9 +413,9 @@ string_list_new (length)
      int length;
 {
   string_list_t s = (string_list_t) malloc (sizeof (struct string_list_def));
-  s->caret_position = 0;
   if (s == NULL)
     return NULL;
+  s->caret_position = 0;
   if (!dyn_string_init ((dyn_string_t) s, length))
     return NULL;
   return s;