Skip to content

simplereader: Fix warning about use of pointer variable after free()#288

Merged
thiagomacieira merged 1 commit intointel:mainfrom
thiagomacieira:simplereader_Fix_warning_about_use_of_pointer_variable_after_free_
Feb 5, 2026
Merged

simplereader: Fix warning about use of pointer variable after free()#288
thiagomacieira merged 1 commit intointel:mainfrom
thiagomacieira:simplereader_Fix_warning_about_use_of_pointer_variable_after_free_

Conversation

@thiagomacieira
Copy link
Member

We weren't dereferencing the variable, so this should have been safe. However, it isn't clear in the C and C++ standards whether it legitimately was safe. So let's just fix it.

simplereader.c:180:9: warning: pointer ‘buf’ may be used after ‘free’ [-Wuse-after-free]
simplereader.c:177:5: note: call to ‘free’ here

@thiagomacieira thiagomacieira enabled auto-merge (rebase) February 5, 2026 19:32
We weren't dereferencing the variable, so this should have been safe.
However, it isn't clear in the C and C++ standards whether it
legitimately was safe. So let's just fix it.

```
simplereader.c:180:9: warning: pointer ‘buf’ may be used after ‘free’ [-Wuse-after-free]
simplereader.c:177:5: note: call to ‘free’ here
```

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
@thiagomacieira thiagomacieira force-pushed the simplereader_Fix_warning_about_use_of_pointer_variable_after_free_ branch from 3964a0f to b72e830 Compare February 5, 2026 19:32
@thiagomacieira thiagomacieira merged commit ef6f923 into intel:main Feb 5, 2026
7 of 9 checks passed
@thiagomacieira thiagomacieira deleted the simplereader_Fix_warning_about_use_of_pointer_variable_after_free_ branch February 5, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants