From Steve Grubb: Fix a memory leak.
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 30 May 2005 20:55:16 +0000 (20:55 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 30 May 2005 20:55:16 +0000 (20:55 +0000)
Don't pass a null to atoi().

Fixes part of bug 217.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14495 f5534014-38df-0310-8fa8-9805f1628bb7

asn1/camel/packet-camel-template.c
epan/dissectors/packet-camel.c

index 452f0e713580d001410264f631c8e429ff82d14d..0f8226b6b365944dc8618002ee03a1e07ed957be 100644 (file)
@@ -508,8 +508,11 @@ dissect_camel_camelPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pac
   application_context_version = 0;
   if (pinfo->private_data != NULL){
     version_ptr = strrchr(pinfo->private_data,'.');
-    version_str = g_strdup(version_ptr+1);
-    application_context_version = atoi(version_str);
+    if (version_ptr) {
+      version_str = g_strdup(version_ptr+1);
+      application_context_version = atoi(version_str);
+      g_free(version_str);
+    }
   }
 
   camel_pdu_type = tvb_get_guint8(tvb, offset)&0x0f;
index 82a0d4671b006d25a4a007c3f39ec34a7c07cf10..6766954712751efcfb15f3f534338873812bf4d4 100644 (file)
@@ -1,6 +1,6 @@
 /* Do not modify this file.                                                   */
 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
-/* .\packet-camel.c                                                           */
+/* ./packet-camel.c                                                           */
 /* ../../tools/asn2eth.py -X -b -e -p camel -c camel.cnf -s packet-camel-template camel.asn */
 
 /* Input file: packet-camel-template.c */
@@ -6538,8 +6538,11 @@ dissect_camel_camelPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pac
   application_context_version = 0;
   if (pinfo->private_data != NULL){
     version_ptr = strrchr(pinfo->private_data,'.');
-    version_str = g_strdup(version_ptr+1);
-    application_context_version = atoi(version_str);
+    if (version_ptr) {
+      version_str = g_strdup(version_ptr+1);
+      application_context_version = atoi(version_str);
+      g_free(version_str);
+    }
   }
 
   camel_pdu_type = tvb_get_guint8(tvb, offset)&0x0f;