corrected memory allocation count using fflag option (mlvdv)
authorGary M. Levin <garrison@ucbvax.Berkeley.EDU>
Wed, 12 Jun 1985 07:47:19 +0000 (23:47 -0800)
committerGary M. Levin <garrison@ucbvax.Berkeley.EDU>
Wed, 12 Jun 1985 07:47:19 +0000 (23:47 -0800)
SCCS-vsn: contrib/bib/src/locate.c 2.5

usr/src/contrib/bib/src/locate.c

index 5d1dfd8..71f840c 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)locate.c   2.4     %G%";
+static char sccsid[] = "@(#)locate.c   2.5     %G%";
 #endif not lint
 #
 
 #endif not lint
 #
 
@@ -140,9 +140,11 @@ int  max_klen;          /* max key length */
         }
 
     total= 0;
         }
 
     total= 0;
-    for (i=0; i<refcnt; i++)    total += refs[i].length+1;
-    if (fflag){
-       total += strlen(refs[i].reffile) + 1;
+    for (i=0; i<refcnt; i++) {
+        total += refs[i].length+1;
+        if (fflag){
+           total += strlen(refs[i].reffile) + 1;
+        }
     }
 
     allrefs= (char *) calloc(total+1, sizeof (char));
     }
 
     allrefs= (char *) calloc(total+1, sizeof (char));