diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-04-26 02:26:22 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-04-26 02:26:22 +0000 |
commit | adf7e454327c141af8557c9aa7217e1e8977a1b3 (patch) | |
tree | e55b01ad32f16745d81f83f12c2fc494a3d2206a /wiretap | |
parent | c7e88aa69f9ee57f606673c5f5f9a239e64c19de (diff) |
Clean up properly if we get an error after allocating the private data
structure.
svn path=/trunk/; revision=32563
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/nettl.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/wiretap/nettl.c b/wiretap/nettl.c index 14fd6877ee..bd4f3834c2 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -240,13 +240,19 @@ int nettl_open(wtap *wth, int *err, gchar **err_info _U_) /* read the first header to take a guess at the file encap */ bytes_read = file_read(dummy, 1, 4, wth->fh); if (bytes_read != 4) { - if (*err != 0) + if (*err != 0) { + wth->priv = NULL; + g_free(nettl); return -1; + } if (bytes_read != 0) { *err = WTAP_ERR_SHORT_READ; + wth->priv = NULL; g_free(nettl); return -1; } + wth->priv = NULL; + g_free(nettl); return 0; } |