Browse Source

handle null smods

Under certain error conditions, smods will be NULL at the end of the function.
Do not call passout if smods is NULL.
Reviewed by: nhosoi (Thanks!)
Rich Megginson 13 years ago
parent
commit
afd6b1fd63
1 changed files with 5 additions and 3 deletions
  1. 5 3
      ldap/servers/plugins/dna/dna.c

+ 5 - 3
ldap/servers/plugins/dna/dna.c

@@ -3493,9 +3493,11 @@ bail:
 
     if (LDAP_CHANGETYPE_MODIFY == modtype) {
         /* Put the updated mods back into place. */
-        mods = slapi_mods_get_ldapmods_passout(smods);
-        slapi_pblock_set(pb, SLAPI_MODIFY_MODS, mods);
-        slapi_mods_free(&smods);
+        if (smods) { /* smods == NULL if we bailed before initializing it */
+            mods = slapi_mods_get_ldapmods_passout(smods);
+            slapi_pblock_set(pb, SLAPI_MODIFY_MODS, mods);
+            slapi_mods_free(&smods);
+        }
     }
 
     slapi_ch_array_free(generated_types);