free野指针问题
gdb backtrace内容如下:
Program received signal SIGABRT, Aborted.
0xb67683c0 in raise () from /lib/libc.so.
(gdb) p cmd
No symbol "cmd" in current context.
(gdb) bt
# 0xb67683c0 in raise () from /lib/libc.so.
# 0xb6762bfc in abort () from /lib/libc.so.
8 #2 0xb67626a8 in free () from /lib/libc.so.0
9 #3 0xb6a8a6dc in cmd_matcher_match_keyword (matcher=0xbeac7080, token=0x917690, argc=0xbeac7698, argv=0xbeac7634)
at /Source_route/wns/apps/openswitch_ori/ops-cli/lib/command.c:
# 0xb6a8a97c in cmd_element_match (cmd_element=0xb65d02ec, filter=FILTER_RELAXED, vline=0x8ec160, index=,
match_type=0x0, match=0x0, argc=0xbeac7698, argv=0xbeac7634)
at /Source_route/wns/apps/openswitch_ori/ops-cli/lib/command.c:
# 0xb6a8ace4 in cmd_parse (cmd_element=0xb65d02ec, vline=0x8ec160, argc=0xbeac7698, argv=0xbeac7634)
at /Source_route/wns/apps/openswitch_ori/ops-cli/lib/command.c:
# 0xb6a8d680 in cmd_execute_command_real (vline=0x8ec160, filter=FILTER_RELAXED, vty=0x8dd290, cmd=0xbeac7798)
at /Source_route/wns/apps/openswitch_ori/ops-cli/lib/command.c:
# 0xb6a8e564 in cmd_execute_command (vline=0x8ec160, vty=0x8dd290, cmd=0xbeac7798, vtysh=)
at /Source_route/wns/apps/openswitch_ori/ops-cli/lib/command.c:
# 0x000278f0 in vtysh_execute_func (line=0x977c8f "snmp-server host 10.54.88.108 inform version v2c community a3 port 162",
pager=) at /Source_route/wns/apps/openswitch_ori/ops-cli/vtysh/vtysh.c:
# 0x00027ec0 in vtysh_execute (line=0x977c8f "snmp-server host 10.54.88.108 inform version v2c community a3 port 162")
at /Source_route/wns/apps/openswitch_ori/ops-cli/vtysh/vtysh.c:
# 0x00025e80 in s_process_cli_cmd (buf=0x985860, len=, msg=0x0, proxy_hdr=0x98581c)
at /Source_route/wns/apps/openswitch_ori/ops-cli/vtysh/vtysh_main.c:
# 0xb6a29a28 in ?? () from /wns/lib/libwns_ipc.so
# 0xb6a29a28 in ?? () from /wns/lib/libwns_ipc.so
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
看第2、3行, 在cmd_matcher_match_keyword 函数中free出错,有两种情况:释放野指针;重复释放(造成野指针)
所以,在看看前文哪里有free行为的代码, 直接注释掉
(gdb) frame
# 0xb6b326dc in cmd_matcher_match_keyword (matcher=0xbec3d080, token=0xb3b690, argc=0xbec3d698, argv=0xbec3d634) at /Source_route/wns/apps/openswitch_ori/ops-cli/lib/command.c:
in /Source_route/wns/apps/openswitch_ori/ops-cli/lib/command.c
(gdb) ptype matcher
type = struct cmd_matcher {
struct cmd_element *cmd;
enum filter_type filter;
vector vline;
unsigned int index;
enum match_type *match_type;
vector *match;
unsigned int word_index;
} *
(gdb)
frame n切换现场查看具体信息
free野指针问题的更多相关文章
- linux kernel elv_queue_empty野指针访问内核故障定位与解决
1. 故障描述 故障操作步骤: 单板上插了一个U盘,出问题前正在通过FTP往单板上拷贝文件,拷贝的过程中单板自动重启. 故障现象: Entering kdb (current=0xc000000594 ...
- iOS为真机调试增加scribble来定位野指针
尽管在ARC中,野指针出现的频率已经大大降低了,但是仍然会有野指针困扰着我们. 在模拟器调试中,我们可以开启scribble或者zombieObject来将已经释放的内存填充无意义的内容,能够将一些非 ...
- C++内存泄露之野指针
写出本文仅仅是处于备忘的目的. 最近为现在做的软件添加了一个内存回收机制(以前处于某种内存只申请不释放,这并不等于内存泄露,因为我们知道这些内存块在内存中的位置)-- 在某一块内存不使用的时候将其释放 ...
- iOS开发_内存泄漏、内存溢出和野指针之间的区别
今天,在工作群中,被问到了内存泄漏和野指针指向的区别,自己答的不是很好,特意回来查了资料,在博文中总结一下经验,欢迎指正. 内存泄漏:是指在堆区,alloc 或new 创建了一个对象,但是并没有放到自 ...
- NULL指针、零指针、野指针
1.1.空指针 如果 p 是一个指针变量,则 p = 0; p = 0L; p = '\0'; p = 3 - 3; p = 0 * 17;p=(void*)0; 中的任何一种赋值操作之后, p 都成 ...
- Xcode 7 调试野指针利器 Address sanitizer
Xcode 7 调试野指针利器 Address sanitizer 什么是Address Sanitizer? AddressSanitizer is a fast memory error dete ...
- 黑马程序员-nil Nil NULL NSNull 野指针和空指针
空指针1.空指针指不含有任何内存地址的指针.在没有具体初始化之前,其被符值为0Dog * dog = nil;Dog * dog = NULL;都为空指针2.野指针指指向的内存为垃圾内存,导致其值不确 ...
- C中的野指针—如何避免
转自:http://www.cnblogs.com/viviwind/archive/2012/08/14/2638810.html 先看一个例子: struct student{ char* nam ...
- C语言 野指针与空指针
//野指针与空指针的区别 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> //野指针是 ...
- 野指针及c++指针使用注意点
避免野指针的产生 “野指针”的成因主要有: 1)指针变量没有被初始化.任何指针变量刚被创建时不会自动成为NULL指针,它的缺省值是随机的,它会乱指一气.所以,指针变量在创建的同时应当被初始化,要么将指 ...
随机推荐
- 错误消息对话框QErrorMessage
继承于 QDialog 样式: 这个复选框的作用:文本框中相同信息时是否再显示 import sys from PyQt5.QtWidgets import QApplication, QWi ...
- CentOS搭建NodeJs服务器—Mongodb安装
1.下载Mongodb 直接下载(下载很慢) cd /mongdb wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon- ...
- logback系列二:logback在项目中的应用
1.输出http日志 2.输出dubbo日志 3.输出interfacer日志 4.输出到access,remote,app等目录中
- 面试题常考&必考之--js中的数组去重和字符串去重
1.引入:首先得知道数组没有可以直接去重的方法,即直接[].unique()是不支持的, 会报“Uncaught TypeError: [].unique is not a function”错误, ...
- BZOJ 3357: [Usaco2004]等差数列 动态规划
Code: #include<bits/stdc++.h> #define setIO(s) freopen(s".in","r",stdin) # ...
- HDU 6230 Palindrome ( Manacher && 树状数组)
题意 : 给定一个字符串S,问你有多少长度为 n 的子串满足 S[i]=S[2n−i]=S[2n+i−2] (1≤i≤n) 参考自 ==> 博客 分析 : 可以看出满足题目要求的特殊回文子串其 ...
- [luogu]P1053 篝火晚会[数学][群论]
[luogu]P1053 篝火晚会 题目描述 佳佳刚进高中,在军训的时候,由于佳佳吃苦耐劳,很快得到了教官的赏识,成为了“小教官”.在军训结束的那天晚上,佳佳被命令组织同学们进行篝火晚会.一共有n个同 ...
- 解决:未能加载文件或程序集“MiniProfiler”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配
参考:https://www.lanhusoft.com/Article/120.html 产生的原因: 公司原来的项目用的是MiniProfiler 3.0.11新项目本来想使用4.0,但是无奈网上 ...
- Windows 搭建Hadoop 2.7.3开发环境
1.安装配置Java环境 1.1.安装Windows版本的jkd应用程序 当前的系统环境是64位Windows 7,因此下载64位JDK,下载地址:http://download.oracle.com ...
- fengmiantu4