Commits

carl douglas committed 091cfe4

use calloc instead of malloc, bzero

  • Participants
  • Parent commits a8c3560

Comments (0)

Files changed (1)

   MYSQL_ROW row;
   char **fields;
   row = mysql_fetch_row(result);
-  fields = (char **)malloc(sizeof(char *) * (num_fields + 1));
+  fields = (char **)calloc(num_fields + 1, sizeof(char *));
   if (fields == NULL) {
     fprintf(stderr, "out of memory\n");
     return(C_SCHEME_FALSE);
   }
-  bzero(fields, sizeof (char *) * (num_fields + 1));
   for (;row && index--;) {
     if (row[index] == NULL) 
       fields[index] = strdup("\x04\x00");