Mismatched free() / delete / delete [] line no missing


 
Thread Tools Search this Thread
Top Forums Programming Mismatched free() / delete / delete [] line no missing
# 1  
Old 11-07-2016
Mismatched free() / delete / delete [] line no missing

Could you tell me the possibilities of the reason to get the Mismatched free() / delete / delete [].

I unable to see the line no in the valgrind report. it displays the function name. with that function name, I am not able to find where exactly the issue is there.I am getting the Mismatched free() / delete / delete [].


Thanks in Advance.

Last edited by rbatte1; 11-07-2016 at 06:11 AM.. Reason: Added ICODE tags for the error message and corrected spelling
# 2  
Old 11-07-2016
Without knowing what language you're using, anything about what your code looks like, nor what error is actually being reported by valgrind, about all that we can say is that you are probably trying to free an area of memory that you allocated at some point in the past and corrupted part of the region of memory that your memory allocation library uses to keep track of its memory pool OR you are trying to free memory that was never allocated.

Without more information, every assignment statement in your code is suspect, every return statement in your code is suspect, and every reference to every object that is a pointer in your code is suspect.
# 3  
Old 11-07-2016
Weren't the explanations in your other thread sufficient? Can't you debug your programme, or, at least, print out the contents of the variables (pointers) in question?
# 4  
Old 11-07-2016
Quote:
Originally Posted by SA_Palani
Could you tell me the possibilities of the reason to get the Mismatched free() / delete / delete [].
From your other thread, you are doing this:
Code:
char *mem=new char;
mem=NULL;
delete mem;

You can't delete NULL. You can only delete a value given to you by new. That's why it crashes.

valgrind is not magic, and the value of the pointer is literally all valgrind, or new / delete, track. If you feed it an invalid pointer, such as NULL, it won't be able to make sense of it.

Duplicate thread closed.

Last edited by Corona688; 11-07-2016 at 06:29 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Comparing two files and writing mismatched rows along with mismatched columns. Pointing out the mism

I got a requirement where I need to compare two files wrt to each columns and write the corresponding difference in another file along with some identification showing mismatched columns. Pointing out the mismatched columns is my main problem statement. For example we have files like: File 1 ... (8 Replies)
Discussion started by: piyush pankaj
8 Replies

2. UNIX for Advanced & Expert Users

Rsync with --delete but do not delete peer dirs on target

rsync with --delete won't honor the delete if the source is something/*. I want the delete to work, but not to delete directories on the target that are peer to the intended directory. For example, using these source and target file structures: Source on desktop: ~/ Money/ ... (4 Replies)
Discussion started by: JavaMeister
4 Replies

3. Linux

Mismatch free() / delete / delete [C++]

Dear All, I got the valgrind report as below Mismatch free() / delete / delete at 0x4006895: operator delete(void*) (vg_replace_malloc.c:480) by 0x8EA6D11: corefunction. I supect that it is expect me to write free() instead of delete p1. Given the the code. I have the structure. ... (7 Replies)
Discussion started by: SA_Palani
7 Replies

4. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

5. UNIX for Dummies Questions & Answers

Delete data blocks based on missing combinations

Hello masters, I am filtering data based on completeness. A (Name , Group) combination in File2 is only complete when it has data for all subgroups specified in File1. All incomplete (Name , Group) combinations do not appear in the output. So for example , Name1 Group 1 in File2 is... (6 Replies)
Discussion started by: senhia83
6 Replies

6. UNIX for Advanced & Expert Users

How to find a string in a line in UNIX file and delete that line and previous 3 lines ?

Hi , i have a file with data as below.This is same file. But actual file contains to many rows. i want to search for a string "Field 039 00" and delete that line and previous 3 lines in that file.. Can some body suggested me how can i do using either sed or awk command ? Field 004... (7 Replies)
Discussion started by: vadlamudy
7 Replies

7. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

8. Shell Programming and Scripting

Delete line with match and previous line quoting/escaping problem

Hi folks, I've list of LDAP records in this format: cat cmmac.export.tmp2 dn: deviceId=0a92746a54tbmd34b05758900131136a506,ou=devices,ou=customer,ou=nl,o=upc cmmac: 00:13:11:36:a5:06 dn: deviceId=0a92746a62pbms4662299650015961cfa23,ou=devices,ou=customer,ou=nl,o=upc cmmac:... (4 Replies)
Discussion started by: tomas.polak
4 Replies

9. Shell Programming and Scripting

Compare files in two folders and delete missing ones

I do not know much about shell scripting so I am at a loss here. If someone can help me, that would be great! I have two directories /dir1 /dir2 I need to delete all files from /dir1 and that does not have a correspondent file in /dir2. It should NOT check file suffixes in /dir2 . Why?... (20 Replies)
Discussion started by: kaah
20 Replies

10. UNIX for Dummies Questions & Answers

How do you delete files that are seemingly missing inodes?

I have some files that appear to have no inode numbers. To complicate the matter, the filenames have UTF8 (I think) characters. I am trying to delete them. In fact, and this might make things easier, I'm trying to delete their parent directory. I don't know what to try next, please help. ... (5 Replies)
Discussion started by: jaffachamp
5 Replies
Login or Register to Ask a Question