:: [DNG] int essid_alloc is causing va…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Edward Bartolo
Fecha:  
A: dng
Asunto: [DNG] int essid_alloc is causing valgrind to report a series of errors
Dear All,

The problem according to my logic seems to be result is used in a
branch control expression before it is initialised. However, I am
emailing this to have other opinions.


int essid_alloc(
    size_t length,
    char ** result
) {
    char * tmp;


    if(length==0 || !result)
        return EINVAL;


    tmp = (char *) calloc(length, 1);


    if(!tmp)
        return ENOMEM;


    *result = tmp;

    
    return 0;
}