fix memory leak more rigorously
This commit is contained in:
parent
15e9d749e2
commit
97f31d5a20
|
|
@ -288,6 +288,7 @@ extern OsdiObjectFile load_object_file(const char *input) {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
fprintf(stderr, "Error opening osdi lib \"%s\": No such file or directory!\n",
|
fprintf(stderr, "Error opening osdi lib \"%s\": No such file or directory!\n",
|
||||||
input);
|
input);
|
||||||
|
txfree(path);
|
||||||
return INVALID_OBJECT;
|
return INVALID_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -302,6 +303,7 @@ extern OsdiObjectFile load_object_file(const char *input) {
|
||||||
* nghash_insert returns NULL if the key (handle) was not already in the table
|
* nghash_insert returns NULL if the key (handle) was not already in the table
|
||||||
* and the data (DUMMYDATA) that was previously insered (!= NULL) otherwise*/
|
* and the data (DUMMYDATA) that was previously insered (!= NULL) otherwise*/
|
||||||
if (nghash_insert(known_object_files, handle, DUMMYDATA)) {
|
if (nghash_insert(known_object_files, handle, DUMMYDATA)) {
|
||||||
|
txfree(path);
|
||||||
return EMPTY_OBJECT;
|
return EMPTY_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -313,11 +315,10 @@ extern OsdiObjectFile load_object_file(const char *input) {
|
||||||
printf("NGSPICE only supports OSDI v%d.%d but \"%s\" targets v%d.%d!",
|
printf("NGSPICE only supports OSDI v%d.%d but \"%s\" targets v%d.%d!",
|
||||||
OSDI_VERSION_MAJOR_CURR, OSDI_VERSION_MINOR_CURR, path,
|
OSDI_VERSION_MAJOR_CURR, OSDI_VERSION_MINOR_CURR, path,
|
||||||
OSDI_VERSION_MAJOR, OSDI_VERSION_MINOR);
|
OSDI_VERSION_MAJOR, OSDI_VERSION_MINOR);
|
||||||
|
txfree(path);
|
||||||
return INVALID_OBJECT;
|
return INVALID_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
txfree(path);
|
|
||||||
|
|
||||||
GET_CONST(OSDI_NUM_DESCRIPTORS, uint32_t);
|
GET_CONST(OSDI_NUM_DESCRIPTORS, uint32_t);
|
||||||
GET_PTR(OSDI_DESCRIPTORS, OsdiDescriptor);
|
GET_PTR(OSDI_DESCRIPTORS, OsdiDescriptor);
|
||||||
|
|
||||||
|
|
@ -386,6 +387,7 @@ extern OsdiObjectFile load_object_file(const char *input) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txfree(path);
|
||||||
return (OsdiObjectFile){
|
return (OsdiObjectFile){
|
||||||
.entrys = dst,
|
.entrys = dst,
|
||||||
.num_entries = (int)OSDI_NUM_DESCRIPTORS,
|
.num_entries = (int)OSDI_NUM_DESCRIPTORS,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue