Code Monkey home page Code Monkey logo

Comments (2)

maartenweyn avatar maartenweyn commented on August 10, 2024

You are right!

Thanks for notifying. I will adapt it.

Maarten

On 1 Sep 2014 07:20, rith87 [email protected] wrote:

There are some places in the code where an object is declared on the stack in a function, passed into some struct as some pointer and then the object goes out of scope. Isn't this rather dangerous since the object goes out of scope?

For example, in trans.c

static void nwl_rx_callback(nwl_rx_res_t* result)
{
...
case D7AQP_COMMAND_TYPE_NA2P_REQUEST:
{
switch (query_result.d7aqp_command.command_code & 0x0F)
{
case D7AQP_OPCODE_ANNOUNCEMENT_FILE:
{
D7AQP_Single_File_Return_Template sfr_tmpl;
sfr_tmpl.return_file_id = data->payload[pointer++];
sfr_tmpl.file_offset = data->payload[pointer++];
sfr_tmpl.isfb_total_length = data->payload[pointer++];
sfr_tmpl.file_data = &data->payload[pointer];

            pointer += sfr_tmpl.isfb_total_length - sfr_tmpl.file_offset;

            query_result.d7aqp_command.command_data = &sfr_tmpl;
        }
    }
    break;
}

...
trans_rx_query_callback(&query_result);
...
}

So, in the above case, sfr_tmpl goes out of scope outside of the switch and then the callback is called. Am I making sense here? Or is there something I don't know about MSP430 programming?


Reply to this email directly or view it on GitHubhttps://github.com//issues/8.

from sub-iot-stack.

glennergeerts avatar glennergeerts commented on August 10, 2024

not relevant anymore after rewrite, closing for now

from sub-iot-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.