Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory/alloc: Use SCCalloc instead of malloc/memset #9305

Closed
wants to merge 1 commit into from

Conversation

jlucovsky
Copy link
Contributor

@jlucovsky jlucovsky commented Jul 29, 2023

Replace SCMalloc/memset with SCCalloc

There are many places that use the following pattern:

     mem = SCMalloc(sizeof(foo));
     if (mem) {
        memset(&mem, 0, sizeof(foo));
    }

These can all be replaced by using SCCalloc which returns 0-filled memory.

Describe changes:

  • Changed SCMalloc followed by memset to SCCalloc

Provide values to any of the below to override the defaults.

To use a pull request use a branch name like pr/N where N is the
pull request number.

Alternatively, SV_BRANCH may also be a link to an
OISF/suricata-verify pull-request.

SV_REPO=
SV_BRANCH=
SU_REPO=
SU_BRANCH=
LIBHTP_REPO=
LIBHTP_BRANCH=

@codecov
Copy link

codecov bot commented Jul 29, 2023

Codecov Report

Merging #9305 (382eba0) into master (2625c82) will decrease coverage by 0.03%.
The diff coverage is 93.19%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9305      +/-   ##
==========================================
- Coverage   82.42%   82.39%   -0.03%     
==========================================
  Files         968      968              
  Lines      274015   273791     -224     
==========================================
- Hits       225852   225600     -252     
- Misses      48163    48191      +28     
Flag Coverage Δ
fuzzcorpus 64.63% <67.28%> (-0.01%) ⬇️
suricata-verify 60.79% <74.76%> (-0.07%) ⬇️
unittests 62.91% <66.38%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 15421

@victorjulien victorjulien added this to the 8.0 milestone Jul 30, 2023
@jlucovsky jlucovsky marked this pull request as ready for review July 31, 2023 11:48
@victorjulien
Copy link
Member

Seems we're in a draft/non-draft situation... :)

@jlucovsky
Copy link
Contributor Author

Seems we're in a draft/non-draft situation... :)

I moved it to non-draft because the CI checks were green.

However, we can leave it in draft form until the release branch has been created.

@victorjulien
Copy link
Member

Seems we're in a draft/non-draft situation... :)

I moved it to non-draft because the CI checks were green.

However, we can leave it in draft form until the release branch has been created.

Was referring to the subject still saying "DRAFT" :)

@jlucovsky jlucovsky changed the title DRAFT: memory/alloc: Use SCCalloc instead of malloc/memset memory/alloc: Use SCCalloc instead of malloc/memset Aug 14, 2023
@jlucovsky
Copy link
Contributor Author

Continued in #9385

@jlucovsky jlucovsky closed this Aug 14, 2023
@jlucovsky jlucovsky deleted the malloc/1 branch November 22, 2023 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants