:: [DNG] int essid_alloc is causing va…
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Edward Bartolo
Ημερομηνία:  
Προς: dng
Αντικείμενο: [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;
}