]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/oidm.c
cleanup
[openldap] / servers / slapd / oidm.c
index 32b4a47e74f017347426bc38081075c62e4e4e05..24ed7d1b217d0acf3ec978afd3eaf2e82b100497 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -100,13 +100,14 @@ parse_oidm(
        OidMacro **rom)
 {
        char *oid;
-       OidMacro *om;
+       OidMacro *om = NULL;
        struct berval bv;
 
        if (argc != 3) {
                fprintf( stderr, "%s: line %d: too many arguments\n",
                        fname, lineno );
 usage: fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
+               if (om) SLAP_FREE( om );
                return 1;
        }
 
@@ -116,12 +117,13 @@ usage:    fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
                        "%s: line %d: "
                        "ObjectIdentifier \"%s\" previously defined \"%s\"",
                        fname, lineno, argv[1], oid );
+               SLAP_FREE( oid );
                return 1;
        }
 
-       om = (OidMacro *) SLAP_MALLOC( sizeof(OidMacro) );
+       om = (OidMacro *) SLAP_CALLOC( sizeof(OidMacro), 1 );
        if( om == NULL ) {
-               Debug( LDAP_DEBUG_ANY, "parse_oidm: SLAP_MALLOC failed", 0, 0, 0 );
+               Debug( LDAP_DEBUG_ANY, "parse_oidm: SLAP_CALLOC failed", 0, 0, 0 );
                return 1;
        }