OSSP CVS Repository

ossp - Check-in [3239]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3239
Date: 2003-Feb-12 17:15:13 (local)
2003-Feb-12 16:15:13 (UTC)
User:rse
Branch:
Comment: throw exceptions also for invalid arguments in allocation wrapper functions
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp_exwrap.c      1.3 -> 1.4     8 inserted, 0 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp_exwrap.c 1.3 -> 1.4

--- lmtp2nntp_exwrap.c   2003/01/30 19:42:13     1.3
+++ lmtp2nntp_exwrap.c   2003/02/12 16:15:13     1.4
@@ -36,6 +36,8 @@
 {
     char *rc;
 
+    if (str == NULL)
+        throw(0,0,0);
     if ((rc = strdup(str)) == NULL)
         throw(0,0,0);
     return rc;
@@ -45,6 +47,8 @@
 {
     char *rc;
 
+    if (s == NULL || n == 0)
+        throw(0,0,0);
     if ((rc = str_dup(s, n)) == NULL)
         throw(0,0,0);
     return rc;
@@ -54,6 +58,8 @@
 {
     void *rc;
 
+    if (size == 0)
+        throw(0,0,0);
     if ((rc = malloc(size)) == NULL)
         throw(0,0,0);
     return rc;
@@ -63,6 +69,8 @@
 {
     void *rc;
 
+    if (ptr == NULL || size == 0)
+        throw(0,0,0);
     if ((rc = realloc(ptr, size)) == NULL)
         throw(0,0,0);
     return rc;

CVSTrac 2.0.1