mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
bug fix : NULL pointer
This commit is contained in:
@ -494,7 +494,7 @@ int UTIL_countPhysicalCores(void)
|
|||||||
if (fgets(buff, BUF_SIZE, cpuinfo) != NULL) {
|
if (fgets(buff, BUF_SIZE, cpuinfo) != NULL) {
|
||||||
if (strncmp(buff, "siblings", 8) == 0) {
|
if (strncmp(buff, "siblings", 8) == 0) {
|
||||||
const char* const sep = strchr(buff, ':');
|
const char* const sep = strchr(buff, ':');
|
||||||
if (*sep == '\0') {
|
if (sep == NULL || *sep == '\0') {
|
||||||
/* formatting was broken? */
|
/* formatting was broken? */
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
@ -503,7 +503,7 @@ int UTIL_countPhysicalCores(void)
|
|||||||
}
|
}
|
||||||
if (strncmp(buff, "cpu cores", 9) == 0) {
|
if (strncmp(buff, "cpu cores", 9) == 0) {
|
||||||
const char* const sep = strchr(buff, ':');
|
const char* const sep = strchr(buff, ':');
|
||||||
if (*sep == '\0') {
|
if (sep == NULL || *sep == '\0') {
|
||||||
/* formatting was broken? */
|
/* formatting was broken? */
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user