fix: memory is allocated but pointer was not checked to null, other pointer was checked 06/11206/2
AKindyakov [Sun, 31 Mar 2013 20:43:26 +0000 (00:43 +0400)]
Change-Id: I977dbfa294077882f0382b49565e4f6bb6e676c5

scilab/modules/matio/sci_gateway/c/sci_matfile_listvar.c

index 8663163..8c7f990 100644 (file)
@@ -98,14 +98,14 @@ int sci_matfile_listvar(char *fname, unsigned long fname_len)
         }
         varnames[nbvar - 1] = strdup(matvar->name);
         varclasses = (double*) REALLOC(varclasses, nbvar * sizeof(double));
-        if (varnames == NULL)
+        if (varclasses  == NULL)
         {
             Scierror(999, _("%s: No more memory.\n"), "matfile_listvar");
             return FALSE;
         }
         varclasses[nbvar - 1] = (double) matvar->class_type;
         vartypes = (double*) REALLOC(vartypes, nbvar * sizeof(double));
-        if (varnames == NULL)
+        if (vartypes == NULL)
         {
             Scierror(999, _("%s: No more memory.\n"), "matfile_listvar");
             return FALSE;