ldif_fetch_url() would return NULL value or pointless memory if file was empty

This commit is contained in:
Hallvard Furuseth 2002-12-02 21:46:58 +00:00
parent 1edcd14a79
commit 2dcf00b82f

View File

@ -87,6 +87,15 @@ ldif_fetch_url(
fclose( url ); fclose( url );
if( total == 0 ) {
char *newp = ber_memrealloc( p, 1 );
if( newp == NULL ) {
ber_memfree( p );
return -1;
}
p = newp;
}
*valuep = p; *valuep = p;
*vlenp = total; *vlenp = total;