SQLite

Check-in [12517d1b15]
Login

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

Overview
Comment:Fix a potential memory leak in RBU if the rbu_fossil_delta() SQL function is misused. Misuse never happens in a working RBU system, so this is not a particularly important fix.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 12517d1b15da46bc90bd95bb9c161d7f2ecdd7f28b1b3a5ed4397939ef986061
User & Date: drh 2019-02-19 17:45:31.317
Context
2019-02-19
18:39
Add the fossildelta.c extension in ext/misc with implementations of the Fossil delta functions. (check-in: b80cafa6f8 user: drh tags: trunk)
17:45
Fix a potential memory leak in RBU if the rbu_fossil_delta() SQL function is misused. Misuse never happens in a working RBU system, so this is not a particularly important fix. (check-in: 12517d1b15 user: drh tags: trunk)
16:42
Fix an assert() that might not be true if the database file is corrupt. (check-in: f2d400db4d user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/rbu/sqlite3rbu.c.
680
681
682
683
684
685
686

687
688
689
690
691
692
693

  aOut = sqlite3_malloc(nOut+1);
  if( aOut==0 ){
    sqlite3_result_error_nomem(context);
  }else{
    nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut);
    if( nOut2!=nOut ){

      sqlite3_result_error(context, "corrupt fossil delta", -1);
    }else{
      sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
    }
  }
}








>







680
681
682
683
684
685
686
687
688
689
690
691
692
693
694

  aOut = sqlite3_malloc(nOut+1);
  if( aOut==0 ){
    sqlite3_result_error_nomem(context);
  }else{
    nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut);
    if( nOut2!=nOut ){
      sqlite3_free(aOut);
      sqlite3_result_error(context, "corrupt fossil delta", -1);
    }else{
      sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
    }
  }
}