gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14542 - gnunet/src/monkey


From: gnunet
Subject: [GNUnet-SVN] r14542 - gnunet/src/monkey
Date: Fri, 25 Feb 2011 11:13:28 +0100

Author: safey
Date: 2011-02-25 11:13:28 +0100 (Fri, 25 Feb 2011)
New Revision: 14542

Modified:
   gnunet/src/monkey/gdbmi_parse.c
Log:
codesonar problems fixed

Modified: gnunet/src/monkey/gdbmi_parse.c
===================================================================
--- gnunet/src/monkey/gdbmi_parse.c     2011-02-25 02:44:10 UTC (rev 14541)
+++ gnunet/src/monkey/gdbmi_parse.c     2011-02-25 10:13:28 UTC (rev 14542)
@@ -50,15 +50,12 @@
  /* Meassure. */
  for (s=str, len=0; *s && !EndOfStr(s); s++)
     {
+        if (!*s) {
+                mi_error = MI_PARSER;
+                return 0;
+        }
      if (*s=='\\')
-       {
-        if (!*s)
-          {
-           mi_error=MI_PARSER;
-           return 0;
-          }
-        s++;
-       }
+        s++;
      len++;
     }
  /* Copy. */
@@ -117,8 +114,10 @@
  l=s-str;
  r=mi_malloc(l+1);
  /* Copy. */
- memcpy(r,str,l);
- r[l]=0;
+ if (NULL != r) {
+        memcpy(r,str,l);
+        r[l]=0;
+ }
  if (end)
     *end=s+1;
  return r;
@@ -1086,16 +1085,16 @@
              n->name=r->v.cstr;
              r->v.cstr=NULL;
             }
-          else if (strcmp(r->var,"in_scope")==0)
+          else if ((NULL != n) && (strcmp(r->var,"in_scope")==0))
             {
              n->in_scope=strcmp(r->v.cstr,"true")==0;
             }
-          else if (strcmp(r->var,"new_type")==0)
+          else if ((NULL != n) && (strcmp(r->var,"new_type")==0))
             {
              n->new_type=r->v.cstr;
              r->v.cstr=NULL;
             }
-          else if (strcmp(r->var,"new_num_children")==0)
+          else if ((NULL != n) && (strcmp(r->var,"new_num_children")==0))
             {
              n->new_num_children=atoi(r->v.cstr);
             }
@@ -1133,7 +1132,7 @@
           return 0;
        if (!v->child)
           v->child=aux;
-       else
+       else if (NULL != cur)
           cur->next=aux;
        cur=aux;
        cur->parent=v;
@@ -1738,9 +1737,12 @@
           cur=cur->next=mi_alloc_chg_reg();
        else
           first=cur=mi_alloc_chg_reg();
-       cur->name=c->v.cstr;
-       cur->reg=cregs++;
-       c->v.cstr=NULL;
+       
+       if (NULL != cur) {
+              cur->name=c->v.cstr;
+              cur->reg=cregs++;
+              c->v.cstr=NULL;
+       }
       }
     c=c->next;
    }
@@ -1891,12 +1893,14 @@
             {
              if (strcmp(c->var,"number")==0)
                {
-                cur->reg=atoi(c->v.cstr);
+               if (NULL != cur) 
+                       cur->reg=atoi(c->v.cstr);
                 (*how_many)++;
                }
              else if (strcmp(c->var,"value")==0)
                {
-                cur->val=c->v.cstr;
+               if (NULL != cur)
+                        cur->val=c->v.cstr;
                 c->v.cstr=NULL;
                }
             }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]