Skip to content

Commit

Permalink
Merge pull request SciresM#42 from lioncash/leak
Browse files Browse the repository at this point in the history
kip, nax0, npdm: Minor build and API fixes
  • Loading branch information
SciresM authored Aug 12, 2018
2 parents 1371815 + 515cbb6 commit 6c3a6a5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions kip.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ void ini1_save(ini1_ctx_t *ctx) {
}
}

const char *kip1_get_json(kip1_ctx_t *ctx) {
char *kip1_get_json(kip1_ctx_t *ctx) {
cJSON *kip_json = cJSON_CreateObject();
const char *output_str = NULL;
char *output_str = NULL;
char work_buffer[0x300] = {0};

/* Add KIP1 header fields. */
Expand Down Expand Up @@ -272,7 +272,7 @@ void kip1_save(kip1_ctx_t *ctx) {
fprintf(stderr, "Failed to open %s!\n", json_path->char_path);
return;
}
const char *json = kip1_get_json(ctx);
char *json = kip1_get_json(ctx);
if (json == NULL) {
fprintf(stderr, "Failed to allocate KIP1 JSON\n");
exit(EXIT_FAILURE);
Expand Down
2 changes: 1 addition & 1 deletion kip.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void ini1_process(ini1_ctx_t *ctx);
void ini1_print(ini1_ctx_t *ctx);
void ini1_save(ini1_ctx_t *ctx);

const char *kip1_get_json(kip1_ctx_t *ctx);
char *kip1_get_json(kip1_ctx_t *ctx);
void kip1_process(kip1_ctx_t *ctx);
void kip1_print(kip1_ctx_t *ctx, int suppress);
void kip1_save(kip1_ctx_t *ctx);
Expand Down
2 changes: 1 addition & 1 deletion nax0.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void nax0_save(nax0_ctx_t *ctx) {
filepath_t *dec_path = &ctx->tool_ctx->settings.plaintext_path;

if (dec_path->valid != VALIDITY_VALID) {
return
return;
}

printf("Saving Decrypted NAX0 Content to %s...\n", dec_path->char_path);
Expand Down
6 changes: 3 additions & 3 deletions npdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ void npdm_save(npdm_t *npdm, hactool_ctx_t *tool_ctx) {
return;
}

const char *json = npdm_get_json(npdm);
char *json = npdm_get_json(npdm);
if (fwrite(json, 1, strlen(json), f_json) != strlen(json)) {
fprintf(stderr, "Failed to write JSON file!\n");
exit(EXIT_FAILURE);
Expand Down Expand Up @@ -832,11 +832,11 @@ cJSON *kac_get_json(uint32_t *descriptors, uint32_t num_descriptors) {
return kac_json;
}

const char *npdm_get_json(npdm_t *npdm) {
char *npdm_get_json(npdm_t *npdm) {
npdm_acid_t *acid = npdm_get_acid(npdm);
npdm_aci0_t *aci0 = npdm_get_aci0(npdm);
cJSON *npdm_json = cJSON_CreateObject();
const char *output_str = NULL;
char *output_str = NULL;
char work_buffer[0x300] = {0};

/* Add NPDM header fields. */
Expand Down
2 changes: 1 addition & 1 deletion npdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void npdm_save(npdm_t *npdm, hactool_ctx_t *tool_ctx);

char *npdm_get_proc_category(int process_category);
void kac_print(uint32_t *descriptors, uint32_t num_descriptors);
const char *npdm_get_json(npdm_t *npdm);
char *npdm_get_json(npdm_t *npdm);

void cJSON_AddU8ToObject(cJSON *obj, char *name, uint8_t val);
void cJSON_AddU16ToObject(cJSON *obj, char *name, uint16_t val);
Expand Down

0 comments on commit 6c3a6a5

Please sign in to comment.