• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nasa / trick / 23871410048

01 Apr 2026 09:20PM UTC coverage: 55.811% (-0.1%) from 55.922%
23871410048

Pull #2011

github

web-flow
Merge 933021c3f into 5cf9d7558
Pull Request #2011: Standardize code style using clang-format

12577 of 22535 relevant lines covered (55.81%)

310562.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.0
/trick_source/sim_services/MemoryManager/ref_free.cpp
1
/*
2
   PURPOSE: (Frees allocated memory within a REF2 structure. Does not free the REF2 itself)
3
   PROGRAMMERS: (((Alex Lin) (NASA) (5/13)))
4
*/
5

6
#include <stdlib.h>
7

8
#include "trick/reference.h"
9
#include "trick/dllist.h"
10

11
extern "C" void ref_free(REF2 * ref) {
647✔
12
    if ( ref ) {
647✔
13
        if ( ref->address_path ) {
641✔
14
            DLLPOS pos = DLL_GetHeadPosition(ref->address_path);
559✔
15
            DLLPOS prev = NULL;
559✔
16
            while (pos != NULL) {
1,118✔
17
                prev = pos;
559✔
18
                // The address nodes were allocated with "new"
19
                delete (ADDRESS_NODE *)DLL_GetNext(&pos, ref->address_path);
559✔
20
                DLL_RemoveAt(prev, ref->address_path);
559✔
21
            }
22
            DLL_Delete(ref->address_path) ;
559✔
23
        }
24

25
        // The reference string was allocated with strdup.
26
        if ( ref->reference ) {
641✔
27
            free(ref->reference) ;
641✔
28
            ref->reference = NULL;
641✔
29
        }
30

31
        // Free units string
32
        if (ref->units) {
641✔
33
            free(ref->units);
1✔
34
            ref->units = NULL;
1✔
35
        }
36

37
        // Free ref_attr, however, not freeing the shared attr
38
        if (ref->ref_attr) {
641✔
39
            free(ref->ref_attr);
×
40
            ref->ref_attr = NULL;
×
41
        }
42
    }
43
    return ;
647✔
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc