X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Fmodules%2Ftext%2Fdepanalysis.c;h=08cf7da4d7edd7962ab98e008f633ee3408d29da;hb=b9ce0bad7daf7c0a2333c91fdb1e35d602afe17f;hp=2019038503290c7c268b1d33c2eb19fc0adf045a;hpb=c7cb53d7585f0e82f031f0f330f71f773c1d95c8;p=lttv.git diff --git a/lttv/modules/text/depanalysis.c b/lttv/modules/text/depanalysis.c index 20190385..08cf7da4 100644 --- a/lttv/modules/text/depanalysis.c +++ b/lttv/modules/text/depanalysis.c @@ -12,8 +12,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -753,15 +753,18 @@ static inline void print_pid(int pid) static void modify_path_with_private(GArray *path, struct process_state *pstate) { char *tmps; + int res; // FIXME: fix this leak switch(pstate->bstate) { case HLEV_INTERRUPTED_IRQ: - asprintf(&tmps, "IRQ %d [%s]", ((struct hlev_state_info_interrupted_irq *)pstate->private)->irq, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(irq_table, &((struct hlev_state_info_interrupted_irq *)pstate->private)->irq))); + res = asprintf(&tmps, "IRQ %d [%s]", ((struct hlev_state_info_interrupted_irq *)pstate->private)->irq, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(irq_table, &((struct hlev_state_info_interrupted_irq *)pstate->private)->irq))); + g_assert(res > 0); g_array_append_val(path, tmps); break; case HLEV_INTERRUPTED_SOFTIRQ: - asprintf(&tmps, "SoftIRQ %d [%s]", ((struct hlev_state_info_interrupted_softirq *)pstate->private)->softirq, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(softirq_table, &((struct hlev_state_info_interrupted_softirq *)pstate->private)->softirq))); + res = asprintf(&tmps, "SoftIRQ %d [%s]", ((struct hlev_state_info_interrupted_softirq *)pstate->private)->softirq, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(softirq_table, &((struct hlev_state_info_interrupted_softirq *)pstate->private)->softirq))); + g_assert(res > 0); g_array_append_val(path, tmps); break; case HLEV_BLOCKED: { @@ -777,7 +780,8 @@ static void modify_path_with_private(GArray *path, struct process_state *pstate) g_array_append_val(path, ptr); } else { - asprintf(&tmps, "Syscall %d [%s]", hlev_blocked_private->syscall_id, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(syscall_table, &hlev_blocked_private->syscall_id))); + res = asprintf(&tmps, "Syscall %d [%s]", hlev_blocked_private->syscall_id, g_quark_to_string((GQuark)(unsigned long)g_hash_table_lookup(syscall_table, &hlev_blocked_private->syscall_id))); + g_assert(res > 0); g_array_append_val(path, tmps); } @@ -787,14 +791,16 @@ static void modify_path_with_private(GArray *path, struct process_state *pstate) } else if(((struct hlev_state_info_blocked *)pstate->private)->substate == HLEV_BLOCKED__READ) { char *str; - asprintf(&str, "%s", g_quark_to_string(((struct hlev_state_info_blocked__read *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename)); + res = asprintf(&str, "%s", g_quark_to_string(((struct hlev_state_info_blocked__read *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename)); + g_assert(res > 0); g_array_append_val(path, str); /* FIXME: this must be freed at some point */ //free(str); } else if(((struct hlev_state_info_blocked *)pstate->private)->substate == HLEV_BLOCKED__POLL) { char *str; - asprintf(&str, "%s", g_quark_to_string(((struct hlev_state_info_blocked__poll *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename)); + res = asprintf(&str, "%s", g_quark_to_string(((struct hlev_state_info_blocked__poll *)((struct hlev_state_info_blocked *)pstate->private)->private)->filename)); + g_assert(res > 0); g_array_append_val(path, str); /* FIXME: this must be freed at some point */ //free(str); @@ -1565,6 +1571,7 @@ static int process_event(void *hook_data, void *call_data) LttvTracefileState *tfs = (LttvTracefileState *)call_data; LttEvent *e; struct marker_info *info; + int res; /* Extract data from event structures and state */ guint cpu = tfs->cpu; @@ -1804,7 +1811,8 @@ static int process_event(void *hook_data, void *call_data) } else { char *tmp; - asprintf(&tmp, "Unknown filename, fd %d", fd); + res = asprintf(&tmp, "Unknown filename, fd %d", fd); + g_assert(res > 0); llev_syscall_read_private->filename = g_quark_from_string(tmp); free(tmp); } @@ -1850,7 +1858,8 @@ static int process_event(void *hook_data, void *call_data) } else { char *tmp; - asprintf(&tmp, "Unknown filename, fd %d", fd); + res = asprintf(&tmp, "Unknown filename, fd %d", fd); + g_assert(res > 0); llev_syscall_poll_private->filename = g_quark_from_string(tmp); free(tmp); }