aitor_czr writes:
> Hi Edward,
>
> You are pointing *result to a pointer 'tmp' declared locally inside
> the function 'essid_alloc', whose value will be lost outside it...
>
> Is it right?
No, it's not. At the point of the assignment, the value of tmp is some
value returned by calloc. And that's
Hi Edward,
You are pointing *result to a pointer 'tmp' declared locally inside the
function 'essid_alloc', whose value will be lost outside it...
Is it right?
Aitor.
On 14/10/15 21:29, Edward Bartolo wrote:
int essid_alloc(
size_t length,
char ** result
) {
char * t
Suppose this is a string in which we are interested:
The value of Pi is 3.142 approximately.
The index of the space preceding Pi is: 18 - 1 = 17
The index of the space after Pi is: 24 - 1 = 23
The length of the decimal number is: 5 characters,
which is also: 23 - 17 - 1 = 5
If we were to copy t
Peter Olson writes:
>> On October 14, 2015 at 3:20 PM Edward Bartolo wrote:
>>
>>
>> This is another part of the backend code where valgrind is saying:
>>
>> ==5501== 5 errors in context 1 of 3:
>> ==5501== Use of uninitialised value of size 8
>> ==5501==at 0x5172AFC: strtod_l_internal
Peter Olson writes:
>> On October 14, 2015 at 3:20 PM Edward Bartolo wrote:
>>
>>
>> This is another part of the backend code where valgrind is saying:
>>
>> ==5501== 5 errors in context 1 of 3:
>> ==5501== Use of uninitialised value of size 8
>> ==5501==at 0x5172AFC: strtod_l_internal
> On October 14, 2015 at 3:20 PM Edward Bartolo wrote:
>
>
> This is another part of the backend code where valgrind is saying:
>
> ==5501== 5 errors in context 1 of 3:
> ==5501== Use of uninitialised value of size 8
> ==5501==at 0x5172AFC: strtod_l_internal (strtod_l.c:889)
> ==5501==
On Wed, 14 Oct 2015, Mat wrote:
> Is there a reason why you need to write such a wrapper around calloc()?
good question. I also have been tempted to do that in the past.
> It adds very little since calloc already sets errno. Plus it's a rather
> unnatural construct for an allocator to return the
Edward Bartolo writes:
> This is another part of the backend code where valgrind is saying:
>
> ==5501== 5 errors in context 1 of 3:
> ==5501== Use of uninitialised value of size 8
> ==5501==at 0x5172AFC: strtod_l_internal (strtod_l.c:889)
> ==5501==by 0x403856: getRadiatingWifiList (a
This is another part of the backend code where valgrind is saying:
==5501== 5 errors in context 1 of 3:
==5501== Use of uninitialised value of size 8
==5501==at 0x5172AFC: strtod_l_internal (strtod_l.c:889)
==5501==by 0x403856: getRadiatingWifiList (automated_scanner.c:265)
==5501==
Edward Bartolo writes:
> 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;
>
>
Is there a reason why you need to write such a wrapper around calloc()?
It adds very little since calloc already sets errno. Plus it's a rather
unnatural construct for an allocator to return the allocated buffer this
way.
if ((err = essid_alloc(len, &buf)) != 0)
handle_error(err);
if (!(b
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 || !res
12 matches
Mail list logo