Fossil

Check-in [ddb975e2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not free memory not obtained from malloc in the "fossil diff" command. Ticket [38d7bb8cf044219c2eff8].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ddb975e2be4c1339c189b96eefe3b28cabf90aaf
User & Date: drh 2010-10-16 12:13:15
Context
2010-10-16
16:24
Do not attempt to parse control artifacts that do not end with a '\n' character. Ticket [be56c89def7f86bcbd] check-in: 7954ccba user: drh tags: trunk
12:13
Do not free memory not obtained from malloc in the "fossil diff" command. Ticket [38d7bb8cf044219c2eff8]. check-in: ddb975e2 user: drh tags: trunk
2010-10-15
22:41
On windows, use the global variable _pgmptr instead of argv[0] in order to find the name of the current executable. Ticket [c8c0b78c840e4df9] check-in: 23a3adac user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diffcmd.c.

251
252
253
254
255
256
257

258
259
260
261
262
263
264
...
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
  while( db_step(&q)==SQLITE_ROW ){
    const char *zPathname = db_column_text(&q,0);
    int isDeleted = db_column_int(&q, 1);
    int isChnged = db_column_int(&q,2);
    int isNew = db_column_int(&q,3);
    int srcid = db_column_int(&q, 4);
    char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);

    int showDiff = 1;
    if( isDeleted ){
      printf("DELETED  %s\n", zPathname);
      if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; }
    }else if( access(zFullName, 0) ){
      printf("MISSING  %s\n", zPathname);
      if( !asNewFile ){ showDiff = 0; }
................................................................................
      printf("Index: %s\n======================================="
             "============================\n",
             zPathname
      );
      diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs);
      blob_reset(&content);
    }
    free(zFullName);
  }
  db_finalize(&q);
  db_end_transaction(1);  /* ROLLBACK */
}

/*
** Output the differences between two versions of a single file.







>







 







|







251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
...
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
  while( db_step(&q)==SQLITE_ROW ){
    const char *zPathname = db_column_text(&q,0);
    int isDeleted = db_column_int(&q, 1);
    int isChnged = db_column_int(&q,2);
    int isNew = db_column_int(&q,3);
    int srcid = db_column_int(&q, 4);
    char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
    char *zToFree = zFullName;
    int showDiff = 1;
    if( isDeleted ){
      printf("DELETED  %s\n", zPathname);
      if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; }
    }else if( access(zFullName, 0) ){
      printf("MISSING  %s\n", zPathname);
      if( !asNewFile ){ showDiff = 0; }
................................................................................
      printf("Index: %s\n======================================="
             "============================\n",
             zPathname
      );
      diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs);
      blob_reset(&content);
    }
    free(zToFree);
  }
  db_finalize(&q);
  db_end_transaction(1);  /* ROLLBACK */
}

/*
** Output the differences between two versions of a single file.