Browse Source

fix memory leak more rigorously

pre-master-46
Markus Mueller 3 years ago
committed by Holger Vogt
parent
commit
bd30bd4e85
  1. 6
      src/osdi/osdiregistry.c

6
src/osdi/osdiregistry.c

@ -288,6 +288,7 @@ extern OsdiObjectFile load_object_file(const char *input) {
if (!path) {
fprintf(stderr, "Error opening osdi lib \"%s\": No such file or directory!\n",
input);
txfree(path);
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
* and the data (DUMMYDATA) that was previously insered (!= NULL) otherwise*/
if (nghash_insert(known_object_files, handle, DUMMYDATA)) {
txfree(path);
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!",
OSDI_VERSION_MAJOR_CURR, OSDI_VERSION_MINOR_CURR, path,
OSDI_VERSION_MAJOR, OSDI_VERSION_MINOR);
txfree(path);
return INVALID_OBJECT;
}
txfree(path);
GET_CONST(OSDI_NUM_DESCRIPTORS, uint32_t);
GET_PTR(OSDI_DESCRIPTORS, OsdiDescriptor);
@ -386,6 +387,7 @@ extern OsdiObjectFile load_object_file(const char *input) {
};
}
txfree(path);
return (OsdiObjectFile){
.entrys = dst,
.num_entries = (int)OSDI_NUM_DESCRIPTORS,

Loading…
Cancel
Save