Fossil

Check-in [afc1cec6]
Login

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

Overview
Comment:Moved a db_finalize() which would not have been called in a couple of error cases.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | json
Files: files | file ages | folders
SHA1: afc1cec6a308d040b5a81f0241e5806352b1c332
User & Date: stephan 2011-09-19 19:03:25
Context
2011-09-20
15:48
Refactored page/command callback to take on argument to simplify certain dispatching ops. json_getenv() now falls back to getenv() if neither the POST data nor cgi_parameter() contains the requested value, but this is basically a workaround for my current inability to add --opt support in CLI mode (due to how HTTP/CLI command handling is consolidated). check-in: 206908fa user: stephan tags: json
2011-09-19
19:03
Moved a db_finalize() which would not have been called in a couple of error cases. check-in: afc1cec6 user: stephan tags: json
18:49
fixed a double-free() which could happen in one error case. check-in: 65e946c7 user: stephan tags: json
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/json.c.

1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303

1304
1305
1306
1307
1308
1309
1310
    if(!v){
      goto error;
    }else if( 0 != cson_array_append( list, v ) ){
      cson_value_free(v);
      goto error;
    }
  }
  db_finalize(&q);
  goto end;
  error:
  g.json.resultCode = FSL_JSON_E_UNKNOWN;
  cson_value_free(listV);
  listV = NULL;
  end:

  return listV;
}

/*
** Mapping of names to JSON pages/commands.  Each name is a subpath of
** /json (in CGI mode) or a subcommand of the json command in CLI mode
*/







<






>







1290
1291
1292
1293
1294
1295
1296

1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
    if(!v){
      goto error;
    }else if( 0 != cson_array_append( list, v ) ){
      cson_value_free(v);
      goto error;
    }
  }

  goto end;
  error:
  g.json.resultCode = FSL_JSON_E_UNKNOWN;
  cson_value_free(listV);
  listV = NULL;
  end:
  db_finalize(&q);
  return listV;
}

/*
** Mapping of names to JSON pages/commands.  Each name is a subpath of
** /json (in CGI mode) or a subcommand of the json command in CLI mode
*/