As far as I remember this was a false positive that has been fixed in one of the last released versions.
When the allocation, assignment and comparision for null pointer was in the same if clause then Cppcheck produced false positives.
I would try using a newer Cppcheck version. Cppcheck 1.90 has been released a few weeks ago.
There were many things fixed and enhancements added since 1.82.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Il presente messaggio e-mail e ogni suo allegato devono intendersi indirizzati esclusivamente al destinatario indicato e considerarsi dal contenuto strettamente riservato e confidenziale. Se non siete l'effettivo destinatario o avete ricevuto il messaggio e-mail per errore, siete pregati di avvertire immediatamente il mittente e di cancellare il suddetto messaggio e ogni suo allegato dal vostro sistema informatico. Qualsiasi utilizzo, diffusione, copia o archiviazione del presente messaggio da parte di chi non ne è il destinatario è strettamente proibito e può dar luogo a responsabilità di carattere civile e penale punibili ai sensi di legge.
Questa e-mail ha valore legale solo se firmata digitalmente ai sensi della normativa vigente.
The contents of this email message and any attachments are intended solely for the addressee(s) and contain confidential and/or privileged information.
If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately notify the sender and then delete this message and any attachments from your system. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited. Unauthorized disclosure and/or use of information contained in this email message may result in civil and criminal liability. “
This e-mail has legal value according to the applicable laws only if it is digitally signed by the sender
Da: Rikard Falkeborn [mailto:rikard@users.sourceforge.net]
Inviato: giovedì 16 gennaio 2020 21:02
A: [cppcheck:discussion]
Oggetto: [cppcheck:discussion] (error) Memory leak
I tested your example and from cppcheck 1.87 and forward, there is no warning.
I wrote the following main.cpp program to show a cppcheck behaviour for me unexpected:
The following compile instruction benerate no message
When I invoke cppcheck i receive an unexpectec memory leak error only in case I use nullptr.
I don't understand if the cppcheck message is correct and, if yes, why.
Does anyone can help me?
Thanks
As far as I remember this was a false positive that has been fixed in one of the last released versions.
When the allocation, assignment and comparision for null pointer was in the same
if
clause then Cppcheck produced false positives.I would try using a newer Cppcheck version. Cppcheck 1.90 has been released a few weeks ago.
There were many things fixed and enhancements added since 1.82.
I tested your example and from cppcheck 1.87 and forward, there is no warning.
Thanks for the support!
Il presente messaggio e-mail e ogni suo allegato devono intendersi indirizzati esclusivamente al destinatario indicato e considerarsi dal contenuto strettamente riservato e confidenziale. Se non siete l'effettivo destinatario o avete ricevuto il messaggio e-mail per errore, siete pregati di avvertire immediatamente il mittente e di cancellare il suddetto messaggio e ogni suo allegato dal vostro sistema informatico. Qualsiasi utilizzo, diffusione, copia o archiviazione del presente messaggio da parte di chi non ne è il destinatario è strettamente proibito e può dar luogo a responsabilità di carattere civile e penale punibili ai sensi di legge.
Questa e-mail ha valore legale solo se firmata digitalmente ai sensi della normativa vigente.
The contents of this email message and any attachments are intended solely for the addressee(s) and contain confidential and/or privileged information.
If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately notify the sender and then delete this message and any attachments from your system. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited. Unauthorized disclosure and/or use of information contained in this email message may result in civil and criminal liability. “
This e-mail has legal value according to the applicable laws only if it is digitally signed by the sender
Da: Rikard Falkeborn [mailto:rikard@users.sourceforge.net]
Inviato: giovedì 16 gennaio 2020 21:02
A: [cppcheck:discussion]
Oggetto: [cppcheck:discussion] (error) Memory leak
I tested your example and from cppcheck 1.87 and forward, there is no warning.
(error) Memory leakhttps://sourceforge.net/p/cppcheck/discussion/general/thread/fa631a6456/?limit=25#537d
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cppcheck/discussion/general/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/