GDU: if decode fails in assignment, reset m_gdu ptr
authorAdam Dickmeiss <adam@indexdata.dk>
Sat, 5 Oct 2013 14:26:33 +0000 (16:26 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Sat, 5 Oct 2013 14:26:33 +0000 (16:26 +0200)
This fixes a SEGV that could otherwise happen.

src/gdu.cpp

index fb87251..467ded2 100644 (file)
@@ -44,7 +44,8 @@ void GDU::base(Z_GDU *gdu, ODR encode)
         char *buf = odr_getbuf(encode, &len, 0);
 
         odr_setbuf(m_decode, buf, len, 0);
-        z_GDU(m_decode, &m_gdu, 0, 0);
+        if (!z_GDU(m_decode, &m_gdu, 0, 0))
+            m_gdu = 0;
     }
     odr_destroy(encode);
 }