Skip to content

Commit

Permalink
Merge pull request #20 from Jason-Lee0/fix
Browse files Browse the repository at this point in the history
fix double free memory
  • Loading branch information
QQting authored Oct 27, 2023
2 parents 52f44ee + 2fcd557 commit 0400558
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ endif()
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/postinst;")
set(CPACK_GENERATOR "DEB")
## Set the package version
set(CPACK_PACKAGE_VERSION "1.3.13")
set(CPACK_PACKAGE_VERSION "1.3.14")
# Set the package name
set(CPACK_PACKAGE_NAME "neuron-library")
# Set the package file format
Expand Down
12 changes: 10 additions & 2 deletions src/x86/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ mraa_x86_platform()
} else {
platform_type = MRAA_UNKNOWN_PLATFORM;
}

free(line);
line = NULL;

}
fclose(fh);
} else {
Expand All @@ -114,15 +117,18 @@ mraa_x86_platform()
plat = mraa_intel_sofia_3gr();
}
free(line);
}
line = NULL;
}
fclose(fh);
}
}

if (platform_type == MRAA_UNKNOWN_PLATFORM){
FILE* file_hold = fopen("/sys/devices/virtual/dmi/id/product_name", "r");

if (file_hold != NULL) {
if (getline(&line, &len, file_hold) != -1) {
line[strcspn(line, "\r\n")] = 0;
line[strcspn(line, "\r\n")] = 0;
if (strncmp(line, "ROScube-I", strlen("ROScube-I")) == 0 ) {
// includes ROScube-I, ROScube-I ET
platform_type = MRAA_ADLINK_ROSCUBE_I;
Expand All @@ -131,7 +137,9 @@ mraa_x86_platform()
syslog(LOG_ERR, "Platform not supported, not initialising");
platform_type = MRAA_UNKNOWN_PLATFORM;
}

free(line);
line = NULL;
}
fclose(file_hold);
}
Expand Down

0 comments on commit 0400558

Please sign in to comment.