Fossil

Check-in [6ad70288]
Login

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

Overview
Comment:Replaced a malloc()/free() with fossil_malloc()/free() and removed the corresponding NULL check (fossil_malloc() dies on error).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6ad70288d9f49a5e59128a3a5ea99a6125a03d67
User & Date: stephan 2012-07-03 21:07:37
Context
2012-07-03
21:10
Minor optimization in stash_create to bypass an unneeded blob_compare() when (isLink!=isNewLink). check-in: 75461b99 user: stephan tags: trunk
21:07
Replaced a malloc()/free() with fossil_malloc()/free() and removed the corresponding NULL check (fossil_malloc() dies on error). check-in: 6ad70288 user: stephan tags: trunk
2012-06-29
23:45
Fix a bug in the manifest generator that was introduced by check-in [01e4de6b8ae936b]. check-in: 5f3a0681 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/json.c.

930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
...
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
    if( !*p || (separator == *p) ){
      if( len ){/* append head..(head+len) as next array
                   element. */
        cson_value * part = NULL;
        char * zPart = NULL;
        ++rc;
        assert( head != p );
        zPart = (char*)malloc(len+1);
        assert( (zPart != NULL) && "malloc failure" );
        memcpy(zPart, head, len);
        zPart[len] = 0;
        if(doDeHttp){
          dehttpize(zPart);
        }
        if( *zPart ){ /* should only fail if someone manages to url-encoded a NUL byte */
          part = cson_value_new_string(zPart, strlen(zPart));
................................................................................
          fossil_exit(1)
            /* Not fossil_panic() b/c this code needs to be able to
              run before some of the fossil/json bits are initialized,
              and fossil_panic() calls into the JSON API.
            */
            ;
        }
        free(zPart);
        len = 0;
      }
      if( !*p ){
        break;
      }
      head = p+1;
      while( *head && fossil_isspace(*head) ){







|
<







 







|







930
931
932
933
934
935
936
937

938
939
940
941
942
943
944
...
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
    if( !*p || (separator == *p) ){
      if( len ){/* append head..(head+len) as next array
                   element. */
        cson_value * part = NULL;
        char * zPart = NULL;
        ++rc;
        assert( head != p );
        zPart = (char*)fossil_malloc(len+1);

        memcpy(zPart, head, len);
        zPart[len] = 0;
        if(doDeHttp){
          dehttpize(zPart);
        }
        if( *zPart ){ /* should only fail if someone manages to url-encoded a NUL byte */
          part = cson_value_new_string(zPart, strlen(zPart));
................................................................................
          fossil_exit(1)
            /* Not fossil_panic() b/c this code needs to be able to
              run before some of the fossil/json bits are initialized,
              and fossil_panic() calls into the JSON API.
            */
            ;
        }
        fossil_free(zPart);
        len = 0;
      }
      if( !*p ){
        break;
      }
      head = p+1;
      while( *head && fossil_isspace(*head) ){