Compare commits
5 Commits
1151c6ac0f
...
d973dc1eea
Author | SHA1 | Date |
---|---|---|
Alexander Couzens | d973dc1eea | |
Alexander Couzens | 0accea361c | |
Alexander Couzens | 6b1813131c | |
Alexander Couzens | eabb847a48 | |
Alexander Couzens | 973c64804a |
|
@ -230,7 +230,7 @@ int ogs_dbi_json_init(const char *filepath, const char *apn)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
buf = ogs_malloc(filesize);
|
||||
buf = malloc(filesize);
|
||||
if (!buf) {
|
||||
ret = -ENOMEM;
|
||||
goto fail;
|
||||
|
@ -265,6 +265,7 @@ int ogs_dbi_json_init(const char *filepath, const char *apn)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
/* TODO: replace free with alloc */
|
||||
db_apn = ogs_dbi_static_alloc_apn();
|
||||
if (!db_apn) {
|
||||
ogs_error("Too many APNs\n");
|
||||
|
@ -286,6 +287,7 @@ int ogs_dbi_json_init(const char *filepath, const char *apn)
|
|||
|
||||
entry = ogs_dbi_static_get_apn_profile(db_apn, profile_id);
|
||||
if (entry) {
|
||||
/* TODO: improve error handling!*/
|
||||
ogs_error("Doublicated profile with id %d\n", profile_id);
|
||||
ret = -1;
|
||||
goto fail;
|
||||
|
@ -338,23 +340,11 @@ int ogs_dbi_json_init(const char *filepath, const char *apn)
|
|||
entry->valid = true;
|
||||
}
|
||||
|
||||
if (profiles)
|
||||
cJSON_Delete(profiles);
|
||||
|
||||
if (buf)
|
||||
ogs_free(buf);
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (db_apn->apn)
|
||||
ogs_free(db_apn->apn);
|
||||
|
||||
if (profiles)
|
||||
cJSON_Delete(profiles);
|
||||
|
||||
if (buf)
|
||||
ogs_free(buf);
|
||||
free(buf);
|
||||
|
||||
fclose(filefp);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue