Skip to content
Snippets Groups Projects
Commit 30b4e2a1 authored by dlukes's avatar dlukes
Browse files

check reallocf() result for failures


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@3008 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent a70e7720
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
<DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
[DL] FreeBSD: check reallocf() result for failures
[AS] FreeBSD: fixing crash on kFreeBSD (#29), patch provided by Petr Salinger
[CF] Makefile.am: 'make check' now tests the syntax of drivedb.h.
......
......@@ -1535,6 +1535,12 @@ int get_dev_names_ata(char*** names) {
};
};
mp = (char **)reallocf(mp,n*(sizeof (char*))); // shrink to correct size
if (mp == NULL && n > 0 ) { // reallocf never fail for size=0, but may return NULL
serrno=errno;
pout("Out of memory constructing scan device list (on line %d)\n", __LINE__);
n = -1;
goto end;
};
bytes += (n)*(sizeof(char*)); // and set allocated byte count
end:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment