mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
fix realloc properly
This commit is contained in:
parent
e7feadf32c
commit
4073b88ed7
1 changed files with 3 additions and 2 deletions
|
@ -99,11 +99,12 @@ int searchHomeFilePath(char **foundpath, const char *subdir, const char *filenam
|
||||||
}
|
}
|
||||||
if (subdir != NULL) {
|
if (subdir != NULL) {
|
||||||
pathlen += strlen(subdir);
|
pathlen += strlen(subdir);
|
||||||
path = realloc(path, pathlen * sizeof(char));
|
char *tmp = realloc(path, pathlen * sizeof(char));
|
||||||
if (path == NULL) {
|
if (tmp == NULL) {
|
||||||
free(path);
|
free(path);
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
path = tmp;
|
||||||
strcat(path, subdir);
|
strcat(path, subdir);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue