Questions tagged [null-pointer]

In computing, a null pointer has a value reserved for indicating that the pointer does not refer to a valid object.

In computing, a null pointer has a value reserved for indicating that the pointer does not refer to a valid object.

Use this tag for programming questions that refers to a problems having null-pointer exception, bad memory access etc.

Resources:

365 questions
-3
votes
1 answer

Is deleting a null pointer in C++ considered undefined behaviour?

Consider the following piece of code: int main() { int *i = nullptr; delete i; } Questions: Is deleting a null pointer considered undefined behaviour? Did something changed in C++11 or C++14?
101010
  • 41,839
  • 11
  • 94
  • 168
-4
votes
1 answer

False positive "Null Dereference" error in Fortify for function call

I am running Fortify SCA and Applications 21.1.1 on a C project and I'm obtaining a "Null pointer dereference" error in the following line: int parameter1 = 1; char *parameter2; int foo = 1; sprintf(parameter2, "%d", foo); pFunction(parameter1,…
-4
votes
3 answers

Null pointer issue

I am facing a MISRA C 2004 violation of rule 1.2 "likely use of null pointer. The code that I am using is as below: tm_uint8* diagBuf = 0u; diagBuf[0] = diagBuf[0] + 0x40u; diagBuf[2] = 0x01u; diagBuf[0] = diagBuf[0] + 0x40u; diagBuf[2] =…
Ankit Shah
  • 97
  • 1
  • 11
-4
votes
3 answers

accessing null pointers to check if linked list is empty in C++

I'm taking a data structures course using C++, and we're supposed to implement a simple single linked-list structure. I have all the other methods figured out, but when I check if the list is empty when it actually is, the program crashes, causing a…
-4
votes
2 answers

Unhandled exception at 0x009f240e in OpenGL and GLUT - 101.exe: 0xC0000005: Access violation writing location 0x00000000

I keep getting the following error: Unhandled exception at 0x009f240e in OpenGL and GLUT - 101.exe: 0xC0000005: Access violation writing location 0x00000000. I have found some questions here with a similar error code but they all seem to say the…
user1824239
  • 167
  • 1
  • 1
  • 5
1 2 3
24
25